Preaddress a reply form to a public folder or an e-mail address
Pre-address a reply form to a public folder or an e-mail address

To pre-address a form to a public folder, you must first add the public folder to the Address Book. For information about how to add a folder to the Address Book, click

1	Open the type of form you wish to pre-address.

2	On the Tools menu of the form, click Address Book.

3	In the Type Name or Select from List box, enter the e-mail address or public folder you want to appear in the To box on the form, and then click OK.

4	On the Tools menu of the form, select Forms and click Design This Form to put the form into design mode.

Note   The user of the form must have permission to access the public folder to which you pre-address a form.


Specify whether a form prompts the user, opens, or is sent

1	In design mode, click the Actions page.

2	Click the action that you want, and then click the Properties button.

3	Under This action will, click the option you want.

Click this option	To
Open the form	Open the form so the user can add information.
Send the form immediately	Send the form to the address specified without opening it.
Prompt the user to open or send	Alert the user with a message that includes the option to open or send the form.
Note   If you click Send the form immediately, you must pre-address the form.


Use standard Reply and Forward headers on a form

1	In design mode, click the Actions page.

2	Click an action that you created, and then click the Properties button.

3	In the Address form like a box, click the header you want to use.

Use this header	To
Reply	Include the sender in the To field and the subject of the message in the Subject field.
Reply to All	Include all the recipients of the message in the To field and the subject of the message in the Subject field.
Forward	Include the subject of the message in the Subject field and leave the To field blank.
Reply to Folder	Show the active folder and show the subject as a conversation, and add Subject and Categories fields.
Response	Use the standard response fields.


Open a task, Calendar item, or note from a custom form

1	In design mode, click the Actions page.

2	Click New.

3	In the Form name box, click Forms.

4	In the top box, click Standard Forms Library.

5	In the box below, click the form that you want to use.


Disable a standard reply form

1	In design mode, click the Actions page.

2	Click the action that you want, and then click the Properties button.

3	Clear the Enabled check box.


Automatically insert text into the Subject field of a reply form

1	In design mode, click the Actions page.

2	Click the action to which you want to add the prefix text, and then click the Properties button.

3	In the Subject prefix box, type the text as you want it to appear (Outlook automatically adds a colon after the text).

For example, you could add the prefix Re: to a reply form.


Add a custom button or menu command to start a reply form

1	In design mode, click the Actions page.

2	Click an action that you created, and then click the Properties button.

3	Select the Show action on check box.

4	Click Menu and Toolbar to add both a button and a menu command.

Click Menu only to add a menu command only.

The text in the Action name box is used as the command name or button name on the form.

Note   The menu command is added to the Actions menu for message forms, the Contact menu for contact forms, and the Appointment menu for appointment forms.


Set options for the original message text in a reply form

1	In design mode, click the Actions page.

2	Click the action that you want, and then click the Properties button.

3	In the When responding box, click an option.

Click	To
Do not include original message	Delete the original text in the message box of the message.
Attach original message	Include the original message as an attachment in the message box of the message.
Include original message text	Include the original message text in the text box of the message exactly how it was written.
Include and indent original message text	Include the original message text and indent it to the right to distinguish it from new text the user adds.
Prefix each line of the original message	Include the original message text in the text box of the message. The text will not be indented but each line of the original message will be prefixed with >.
Attach link to original message	Include a link to the original message.
Respect user’s default	Use the user’s Tools menu, Options dialog box settings.


Create a custom reply form

1	Create the custom reply form with the options and layout that you want.

2	Publish the form to your Personal Forms Library.

How?

3	Set options on the main form that is associated with the reply form.

How?


Set options on a form that is associated with a reply form

1	In design mode, click the Actions page.

2	Click New.

3	In the Action name box, type a name for the menu command and button that you want to use to open the custom reply form.

For example, if you type Send to Finance in the Action name box, the Read page of the form includes a Send to Finance command on the Actions menu (and a Send to Finance button on the toolbar if you select the option for both).

4	In the Form name box, type the name of the custom reply form that you want to associate with this form.

5	Select the Show action on check box, and then click the option that you want.

6	Under Characteristics of the new form, select the options that you want.

7	Click OK.

8	In the list of actions, disable the standard reply actions that you want to remove.

For example, if you create a custom reply action, you should disable the standard Outlook reply action.

How?

9	Open the custom reply form you associated with this form, and then click the Properties page.

10	Click the Use form only for responses option.

This removes the form from the forms library list so it cannot be selected by mistake. To edit the form you must make it visible.

How?


Unhide a form
Make a hidden form visible

1	On the Tools menu, click Options, then click the Other tab.

2	Click the Advanced Options button.

3	Click the Custom Forms button.

4	Click the Manage Forms button.

5	Click the form you want to make visible.

6	Click the Properties Button.

7	Clear the Hidden check box.


Create a reply form

When you create a Message form, you often want users to send a reply by using a reply form.

An action automatically opens a reply form, typically when a user clicks Reply, Forward, or another command on the form. For example, an action can create a Forward button, that, when selected by the user, opens a Forward form for the user to fill in and send to reply to your message. You can specify that the form use standard Reply and Forward headers, and you can even add prefix text, such as RE: to the Subject field of your custom reply form.

You can use the default reply forms included with Outlook (these are the forms listed on the Actions page), or you can disable any of these forms and create a custom reply form. The custom reply forms that you create are listed on the Actions page in design mode in the form.

You can create custom buttons and menu commands and specify what happens when the user chooses them. You can also create a button or menu command that opens a task, a Calendar item, or even a note.

You can send information without opening a reply form by pre-addressing a custom reply form to go to a specific e-mail address or to a public folder.

What do you want to do?

Create a custom reply form

Add a custom button or menu command to start a reply form

Open a task, Calendar item, or note from a custom form

Use standard Reply and Forward headers on a form

Automatically insert text into the Subject field of a reply form

Specify whether a form prompts the user, opens, or is sent

Pre-address a reply form to a public folder or an e-mail address


Select multiple controls and the dominant control

You can select more than one control in three ways. In addition, when you select multiple controls, one of the controls becomes a reference for the rest and is called the dominant control.

Selection method	What is selected	Dominant control
SHIFT+CLICK	All controls in an invisible rectangle around the selected controls.	First control you select
CTRL+CLICK	Individual controls, one at a time.	Last control you select.
Select Objects pointer in the Control Toolbox	All controls that fall within or touch a rectangle you draw.	Control nearest the mouse pointer when you begin drawing the rectangle.
Tips

•	Occasionally the CTRL+CLICK method may select additional controls that are near to or adjacent to the selected controls. For more accuracy, use the Select Objects pointer method.

•	If you CTRL+CLICK twice on a selected control, that control becomes the dominant control.


Show or hide the grid

•	In design mode, click Show Grid on the Layout menu.


Set the grid size

1	In design mode, click Set Grid Size on the Form menu.

2	In the Height and Width boxes, type the dimensions that you want.

Tip   If you use the Arrange command (Layout menu) to position command buttons in your application, use small grid settings so that you can position the command buttons closer to the edge of the form.


Turn on or off sizing controls to the grid

•	In design mode, click Snap to Grid on the Layout menu or click the Snap to Grid icon on the toolbar.


Align controls

1	Select the controls that you want to align to part of the dominant control.

How?

2	On the Layout menu, point to Align, and then click one of the following.

Click	To
Left	Align controls to the left edge of the dominant control.
Center	Align the center of controls to the vertical center of the dominant control.
Right	Align controls to the right edge of the dominant control.
Top	Align controls to the top edge of the dominant control.
Middle	Align the center of controls to the horizontal center of the dominant control.
Bottom	Align controls to the bottom edge of the dominant control.
To Grid	Align the upper-left corner of controls with their nearest grid point. Note that this option is not based on the position of the dominant control.


Size controls

1	Select the controls that you want to size to the dominant control.

How?

2	On the Layout menu, point to Make Same Size, and then click one of the following.

Click	To
Width	Make all selected controls the same width as the dominant control.
Height	Make all selected controls the same height as the dominant control.
Both	Make all selected controls the same height and width as the dominant control.
Note   To size a control to fit its contents (both its picture and any text assigned to the Caption or Text property), select the control, and then click Size to Fit on the Layout menu.


Space controls

1	Select the controls for which you want to adjust spacing.

2	On the Layout menu, point to Horizontal Spacing or Vertical Spacing, and then click one of the following.

Click	To
Make Equal	Make all horizontal and vertical spaces between controls the same size. The amount of horizontal and vertical space will vary based on the area available to show controls and the combined width of all controls.
Increase	Increase the space between controls by one grid block.
Decrease	Decrease the space between controls by one grid block.
Remove	Remove the space between controls. The controls do not overlap, but are immediately adjacent to each other.


Use z-order to layer controls

1	Select the controls you want to reposition in the z-order.

2	On the Layout menu, point to Order, and then click one of the following.

Click	To move control
Bring to Front	To the top of the z-order.
Send to Back	To the bottom of the z-order.
Bring Forward	Up one position in the z-order.
Send Backward	Down one position in the z-order.
Notes

•	You can't Undo or Redo layering commands, such as Send to Back or Bring to Front.

•	If the form includes any ListBox, Frame, or MultiPage controls, these controls automatically move as close as possible to the top of the stack. For example, applying Send Backward to a ListBox, Frame, or MultiPage control moves the control below other ListBox, Frame, or MultiPage controls, but does not move the control below any other type of control in the stack. Similarly, applying Bring Forward to a control other than a ListBox, Frame, or MultiPage control moves the control closer to the top of the stack, but does not move the control above any ListBox, Frame, or MultiPage control in the stack.

Visually, this means that if a ListBox, Frame, or MultiPage control and any other Microsoft Forms controls are in the same location on a form, the ListBox, Frame, or MultiPage control always appears on top of the other control(s). If a ListBox, Frame, or MultiPage control is in the same place as another ListBox, Frame, or MultiPage control, the z-order of the controls determines which control appears on top of the other.


About groups of controls

A group is two or more controls on a form that you can work with as a single unit. You can include any control on the form in a group. Once controls belong to a group, you can work with the entire group, or you can select a single control.

There are many ways to work with groups and the controls in groups. After you select a group, you can do any of the following.

•	Size all controls in the group at the same time. For information, click   [image].

•	Separate controls in the group so each is independent of the others. For information, click   [image].

•	Show the group shortcut menu for quick access to commands that affect the group. For information, click   [image].

•	Select a single control within the group without separating controls in the group. You can then change property settings of the selected control without affecting any other control in the group. For information, click   [image].


Create a group of controls

1	Select each control that you want to include in the group. The dominant control does not affect this procedure.

How?

2	On the Layout menu, click Group.


Separate controls in a group

1	Select the group of controls.

2	On the Layout menu, click Ungroup.


Select and edit a control within a group

1	Select the group of controls.

2	Select a single control within the group. The sizing handles around the group become lighter, and dark sizing handles appear on the selected control.

3	Make the changes that you want to the selected control properties. Any change you make affects only the selected control.

4	When you’re finished, click anywhere in the group, but don’t click on the selected control. The group is still selected.

5	Select another control in the group or go on to another task.


Center controls in a form

1	Select the controls or groups of controls that you want to center. The dominant control does not affect this procedure.

How?

2	On the Layout menu, point to Center in Form, and then click Horizontally or Vertically.


Automatically resize controls

You can set controls to resize horizontally or vertically when a user changes the size of the form. The size of the control changes in proportion to the size of the form. For example, when a user changes the size of a message, the body resizes automatically.

Resize a control horizontally with the form

Resize a control vertically with the form

Resize a control horizontally and vertically with the form


Resize a control horizontally and vertically with the form

This procedure sets an invisible property. After you complete the procedure, you should remove the code from the Script Editor.

1	In design mode, select the control, and then size it relative to the form. For example, if you want the control to always be same as the height of the form, make the bottom edge of the control equal to the bottom edge of the form.

2	On the Form menu, click View Code.

3	Add the following code to the Script Editor. Replace “TextBox1” with the name of the control you want to resize, and replace “P. 2” with the name of your page. Although this example uses the Write event, you can use any event to run the code.

Sub Item_Write

Item.GetInspector.ModifiedFormPages("P.2").TextBox1.LayoutFlags = 65

End Sub

4	On the Tools menu of the form, select Forms and click Run This Form.

5	On the File menu of the form, click Save.

Note   To reset the LayoutFlags property, right-click the control, and then click Properties on the shortcut menu. On the Display page, if the Resize with form check box is selected, clear it; if the Resize with form check box is cleared, select it and then clear it.


Resize a control vertically with the form

This procedure sets an invisible property. After you complete the procedure, you can remove the code from the Script Editor.

1	In design mode, select the control, and then size it relative to the form. For example, if you want the control to always be the height of the form, make the bottom edge equal to the bottom edge of the form.

2	On the Form menu, click View Code.

3	Add the following code to the Script Editor. Replace “TextBox1” with the name of the control you want to resize, and replace “P. 2” with the name of your page. Although this example uses the Write event, you can use any event to run the code.

Sub Item_Write

Item.GetInspector.ModifiedFormPages("P.2").TextBox1.LayoutFlags = 68

End Sub

4	On the Tools menu of the form, select Forms and click Run This Form.

5	On the File menu of the form in run mode, click Save.

Note   To reset the LayoutFlags property, right-click the control, and then click Properties on the shortcut menu. On the Display page, if the Resize with form check box is selected, clear it; if the Resize with form check box is cleared, select it and then clear it.


Resize a control horizontally with the form

1	Right-click the control, and then click Properties on the shortcut menu.

2	On the Display tab, select the Resize with form check box.


Right-align a control on a form

1	Drag a Label button control from the Control Toolbox to the left of the spot where you would like to align a control.

2	Remove any text from the Caption property.

3	Right-click the label, and then click Properties on the shortcut menu.

4	On the Display page, select the Resize with form check box.

5	Create the control you want to align.

6	Place the control to the right of the Label control.


Label control

Displays descriptive text.

Remarks

A Label control on a form displays descriptive text such as titles, captions, pictures, or brief instructions. For example, labels for an address book might include a Label for a name, street, or city.

The default property for a Label is the Caption property.

Note  You can also display a picture on a Label. However, a Label does not let you crop, size, or zoom the picture.


TextBox control

Displays information from a user or from an organized set of data.

Remarks

A TextBox is the control most commonly used to display information entered by a user. Also, it can display a set of data, such as a table, query, worksheet, or a calculation result. If a TextBox is bound to a data source, then changing the contents of the TextBox also changes the value of the bound data source.

Formatting applied to any piece of text in a TextBox will affect all text in the control. For example, if you change the font or point size of any character in the control, the change will affect all characters in the control.

The default property for a TextBox is the Value property.

Tips on using text boxes

The TextBox is a flexible control governed by the following properties: Text, MultiLine, WordWrap, and AutoSize.

Text contains the text that’s displayed in the text box.

MultiLine controls whether the TextBox can display text as a single line or as multiple lines. Newline characters identify where one line ends and another begins. If MultiLine is False (the default value), the text is truncated instead of wrapped.

WordWrap allows the TextBox to wrap lines of text that are longer than the width of the TextBox into shorter lines that fit. The default value is True.

If you do not use WordWrap, the TextBox starts a new line of text when it encounters a newline character in the text. If WordWrap is turned off, you can have text lines that do not fit completely in the TextBox. The TextBox displays the portions of text that fit inside its width and truncates the portions of text that do not fit. WordWrap is not applicable unless MultiLine is True.

AutoSize controls whether the TextBox adjusts to display all of the text. When using AutoSize with a TextBox, the width of the TextBox shrinks or expands according to the amount of text in the TextBox and the font size used to display the text. The default value is False.

AutoSize works well in the following situations:

•	Displaying a caption of one or more lines.

•	Displaying the contents of a single-line TextBox.

•	Displaying the contents of a multiline TextBox that is read-only to the user.

Note   Avoid using AutoSize with an empty TextBox that also uses the MultiLine and WordWrap properties. When the user enters text into a TextBox with these properties, the TextBox automatically sizes to a long narrow box one character wide and as long as the line of text.


ComboBox control

Combines the features of a ListBox and a TextBox. The user can enter a new value, as with a TextBox, or the user can select an existing value as with a ListBox.

Remarks

If a ComboBox is bound to a data source, the ComboBox inserts the value entered or selected by the user into that data source. If a multicolumn combo box is bound, then the BoundColumn property determines which value is stored in the bound data source.

The list in a ComboBox consists of rows of data. Each row can have one or more columns, which can appear with or without headings. Some applications do not support column headings, others provide only limited support.

The default property of a ComboBox is the Value property.

Note  If you want more than a single line of the list to appear at all times, you might want to use a ListBox instead of a ComboBox. If you want to use a ComboBox and limit values to those in the list, you can set the Style property of the ComboBox so the control looks like a drop-down list box.


ListBox control

Displays a list of values and lets you select one or more.

Remarks

If the ListBox is bound to a data source, the ListBox stores the selected value in that data source.

The ListBox can either appear as a list or as a group of OptionButton controls or CheckBox controls.

The default property for a ListBox is the Value property.

The default event for a ListBox is the Click event.

Note   You can't drop text into a drop-down ListBox.

ListBox styles

You can choose between two presentation styles for a ListBox. Each style provides different ways for users to select items in the list.

If the style is Plain, each item is on a separate row; the user selects an item by highlighting one or more rows.

If the style is Option, an OptionButton or CheckBox appears at the beginning of each row. With this style, the user selects an item by clicking the option button or check box. Check boxes appear only when the MultiSelect property is True.


CheckBox control

Displays the selection state of an item.

Remarks

Use a CheckBox to give the user a choice between two values such as Yes/No, True/False, or On/Off. When the user selects a CheckBox, it displays a special mark (such as an X) and its current setting is Yes, True, or On. If the user does not select the CheckBox, it is empty and its setting is No, False, or Off. Depending on the value of the TripleState property, a CheckBox can also have a null value.

If a CheckBox is bound to a data source, changing the setting changes the value of that source. A disabled CheckBox shows the current value, but is dimmed and does not allow changes to the value from the user interface.

You can also use check boxes inside a group box to select one or more of a group of related items. For example, you can create an order form that contains a list of available items, with a CheckBox preceding each item. The user can select a particular item or items by checking the corresponding CheckBox.

The default property of a CheckBox is the Value property.

Note  The ListBox also lets you put a check mark by selected options. Depending on your application, you can use the ListBox instead of using a group of CheckBox controls.


OptionButton control

Shows the selection status of one item in a group of choices.

Remarks

Use an OptionButton to show whether a single item in a group is selected. Note that each OptionButton in a Frame is mutually exclusive.

If an OptionButton is bound to a data source, the OptionButton can show the value of that data source as either Yes/No, True/False, or On/Off. If the user selects the OptionButton, the current setting is Yes, True, or On. If the user does not select the OptionButton, the setting is No, False, or Off. For example, an OptionButton in an inventory-tracking application might show whether an item is discontinued. If the OptionButton is bound to a data source, then changing the setting changes the value of that data source. A disabled OptionButton is dimmed and does not show a value.

Depending on the value of the TripleState property, an OptionButton can also have a null value.

You can also use an OptionButton inside a group box to select one or more of a group of related items. For example, you can create an order form with a list of available items, with an OptionButton preceding each item. The user can select a particular item by checking the corresponding OptionButton.

The default property for an OptionButton is the Value property.


ToggleButton control

Shows the selection state of an item.

Remarks

Use a ToggleButton to show whether an item is selected. If a ToggleButton is bound to a data source, the ToggleButton shows the current value of that data source as either Yes/No, True/False, On/Off, or some other choice of two settings. If the user selects the ToggleButton, the current setting is Yes, True, or On. If the user does not select the ToggleButton, the setting is No, False, or Off. If the ToggleButton is bound to a data source, changing the setting changes the value of that data source. A disabled ToggleButton shows a value, but is dimmed and does not allow changes from the user interface.

You can also use a ToggleButton inside a Frame to select one or more of a group of related items. For example, you can create an order form with a list of available items, with a ToggleButton preceding each item. The user can select a particular item by selecting the appropriate ToggleButton.

The default property of a ToggleButton is the Value property.

The only event for a ToggleButton is the Click event.


Frame control

Creates a functional and visual control group.

Remarks

All option buttons in a Frame are mutually exclusive, so you can use the Frame to create an option group. You can also use a Frame to group controls with closely related contents.For example, in an application that processes customer orders, you might use a Frame to group the name, address, and account number of customers.

You can also use a Frame to create a group of ToggleButtons, but the toggle buttons are not mutually exclusive.

To create a group of mutually exclusive OptionButton controls, you can put the buttons in a Frameon your form, or you can use the GroupName property.


CommandButton control

Starts, ends, or interrupts an action or series of actions.

Remarks

Requires VBScript.

Syntax

Sub CommandButton_Click( )

    ‘write event code here

End Sub

The macro or event procedure assigned to the CommandButton's Click event determines what the CommandButton does. For example, you can create a CommandButton that opens another form. You can also display text, a picture, or both on a CommandButton.

The default property of a CommandButton is the Value property.

The only event for a CommandButton is the Click event.


TabStrip control

Presents a set of related controls as a visual group.

Remarks

You can use a TabStrip to view different sets of information for related controls.

A TabStrip is a control that contains a collection of one or more tabs.

Each Tab of a TabStrip is a separate object that users can select. Visually, a TabStrip also includes a client area that all the tabs in the TabStrip share.

By default, a TabStrip includes two pages, called Tab1 and Tab2. Each of these is a Tab object, and together they represent the Tabs collection of the TabStrip. If you add more pages, they become part of the same Tabs collection.

For example, the controls might represent information about a daily schedule for a group of individuals, with each set of information corresponding to a different individual in the group. Set the title of each tab to show one individual's name. Then, you can write code that, when you click a tab, updates the controls to show information about the person identified on the tab.

Note  The TabStrip is implemented as a container of a Tabs collection, which in turn contains a group of Tab objects.

The default property for a TabStrip is the SelectedItem property.


MultiPage control

Presents multiple screens of information as a single set.

Remarks

A MultiPage is useful when you work with a large amount of information that can be sorted into several categories. For example, use a MultiPage to display information from an employment application. One page might contain personal information such as name and address; another page might list previous employers; a third page might list references. The MultiPage lets you visually combine related information, while keeping the entire record readily accessible.

New pages are added to the right of the currently selected page rather than adjacent to it.

A MultiPage is a control that contains a collection of one or more pages.

Each Page of a MultiPage is a form that contains its own controls, and as such, can have a unique layout. Typically, the pages in a MultiPage have tabs so the user can select the individual pages.

By default, a MultiPage includes two pages, called Page1 and Page2. Each of these is a Page object, and together they represent the Pages collection of the MultiPage. If you add more pages, they become part of the same Pages collection.

The default property for a MultiPage is the Value property, which returns the index of the currently active Page in the Pages collection of the MultiPage.


ScrollBar control

Returns or sets the value of another control based on the position of the scroll box.

Remarks

Requires VBScript.

A ScrollBar is a stand-alone control you can place on a form. It is visually like the scroll bar you see in certain objects such as a ListBox or the drop-down portion of a ComboBox. However, unlike the scroll bars in these controls, the stand-alone ScrollBar is not an integral part of any other control.

To use the ScrollBar to set or read the value of another control, you must write code for the ScrollBar’s events and methods. For example, to use the ScrollBar to update the value of a TextBox, you can write code that reads the Value property of the ScrollBar and then sets the Value property of the TextBox.

The default property for a ScrollBar is the Value property.

Note  To create a horizontal or vertical ScrollBar, drag the sizing handles of the ScrollBar horizontally or vertically on the form.


SpinButton control

Increments and decrements numbers.

Remarks

Requires VBScript.

Clicking a SpinButton changes only the value of the SpinButton. You can write code that uses the SpinButton to update the displayed value of another control. For example, you can use a SpinButton to change the month, the day, or the year shown on a date. You can also use a SpinButton to scroll through a range of values or a list of items, or to change the value displayed in a text box.

To display a value updated by a SpinButton, you must assign the value of the SpinButton to the displayed portion of a control, such as the Caption property of a Label or the Text property of a TextBox. To create a horizontal or vertical SpinButton, drag the sizing handles of the SpinButton horizontally or vertically on the form.

The default property for a SpinButton is the Value property.


Image control

Displays a picture on a form.

Remarks

The Image control lets you display a picture as part of the data in a form. For example, you might use an Image to display employee photographs in a personnel form.

The Image lets you crop, size, or zoom a picture, but does not allow you to edit the contents of the picture. For example, you cannot use the Image to change the colors in the picture, to make the picture transparent, or to refine the image of the picture. You must use image editing software for these purposes.

The Image supports the following file formats:

•	*.bmp

•	*.cur

•	*.gif

•	*.ico

•	*.jpg

•	*.wmf

Note  You can also display a picture on a Label. However, a Label does not let you crop, size, or zoom the picture.


design mode

The design environment for Outlook Forms, also called design time, is when the designer creates the form. A form in design mode shows the word {Design} to the right of the form name in the title bar.

Design mode is sometimes referred to as the Outlook Form Designer, but this term is misleading. The ability to design forms does not require the installation of a separate product .

To begin designing a form, open a new form of the type you would like to design, such as a Mail Message or Contact. On the Tools menu of the new form, select Forms and click Design This Form. If you would like to design a different type of form, with the original form open, on the Tools menu of the form, select Forms and click Design Form. Choose the form you would like to design.

To switch between design mode and run mode, on the Tools menu of the form you are designing, select Forms and click Run This Form. To switch back to design mode, close the new form and you will be back to the form in design mode.


dominant control

The dominant control is the control to which other selected controls are aligned and sized.  When aligning controls, selected controls align to the dominant control. When sizing controls, selected controls are assigned the dimensions of the dominant control.

The sizing handles of the dominant control are white, and the sizing handles for the other selected controls are black.


client scripts


server scripts

Server scripts consists of statements embedded in an .asp file (Active Server Page). The script is executed by the Microsoft Internet Information Server (IIS) when the page is requested by the browser but before the content is sent to the browser. Server scripts typically manage links between pages, process HTML forms, and interact with databases.


z-order

The visual layering of controls on a form along the form z-axis (depth). The z-order determines the controls that are in front of other controls.


grid block

The space between two adjacent grid points.


data source

The location of data to which a control is bound. For example, a field in a Contacts folder. The value of the data source can be stored in the Value property of a control. However, the control does not store the data; it only shows the information that is stored in the data source.


forms cache

The folder located in C:\Windows\Forms that serves as a storage location for forms.


unbound

Describes a control that is not related to a field.


bound

Describes a control whose contents is associated with a particular data source, such as a field in a Contacts folder. This means that a link will be established between the control and the source of data, in this case, a field on the form. Controls created by dragging a standard field from the Field Chooser are automatically bound.


modal

Describes a window or dialog box that requires the user to take some action before the focus can switch to another form or dialog box.


modeless

Describes a window or dialog box that does not require the user to perform an action before the focus can be switched to another form or dialog box.


null

A value indicating that a variable contains no valid data. Null is the result of an explicit assignment of Null to a variable or any operation between expressions that contain Null.


control group

A set of controls that are conceptually or logically related. Controls that are conceptually related are usually viewed together but do not necessarily affect each other. Controls that are logically related affect each other. For example, setting one button in a group of option buttons sets the value of all other buttons in the group to False.


container

An object that can contain other objects.


collection

An object that contains a set of related objects. An object's position in the collection can change whenever a change occurs in the collection; therefore, the position of any specific object in the collection may vary.


transparent

Describes the background of the object if the background is not visible. Instead of the background, you see whatever is behind the object; for example, an image or picture used as a backdrop in your form. Use the BackStyle property to make the background transparent.


background color

The color of the client region of an empty window or display screen, on which all drawing and color display takes place.


foreground color

The color that is currently selected for drawing or displaying text on screen. In monochrome displays, the foreground color is the color of a bitmap or other graphic.


system colors

Colors that are defined by the operating system for a specific type of monitor and video adapter. Each color is associated with a specific part of the user interface, such as a window title or a menu.


array

A set of sequentially indexed elements having the same intrinsic data type. Each element of an array has a unique identifying index number. Changes made to one element of an array do not affect the other elements.


tab order

The order in which the focus moves from one field or object to the next as you press TAB or SHIFT+TAB.


control tip

A brief phrase that describes a control, a page, or a tab. The control tip appears when the user briefly holds the mouse pointer over a control.


client region

The portion of a window where an application displays output such as text or graphics.


accelerator key

A single character used as a shortcut for selecting an object. Pressing the ALT key followed by the accelerator key gives focus to the object and initiates one or more events associated with the object. The specific event or events initiated varies from one object to another. If code is associated with an event, it is processed when the event is initiated. Also called keyboard accelerator, shortcut key, keyboard shortcut.


focus

The ability to receive mouse clicks or keyboard input at any one time. In Microsoft Windows, only one window, form, or control can have this ability at a time. The object that "has the focus" is usually indicated by a highlighted caption or title bar. The focus can be set by the user or by the application.


point

In typography, a point is 1/72 inch. Font size is usually expressed in points.


RGB

A color value system used to describe colors as a mixture of red (R), green (G), and blue (B). The color is defined as a set of three integers (R,G,B) where each integer ranges from 0–255. A value of 0 indicates a total absence of a color component. A value of 255 indicates the highest intensity of a color component.


OLE container controls

A Visual Basic control that is used to link and embed objects from other applications in a Visual Basic application.


data format

The structure or appearance of a unit of data, such as a field, or text in a message body.


target

An object onto which the user drops the object being dragged.


run mode

The environment, also called run time, when the form appears as it looks when being used and when code is running. During run mode, you interact with the macros as a user would.

To begin designing a form, open a new form of the type you would like to design, such as a Mail Message or Contact. On the Tools menu of the new form, select Forms and click Design This Form. If you would like to design a different type of form, with the original form open, on the Tools menu of the form, select Forms and click Design Form. Choose the form you would like to design.

To switch between design mode and run mode, on the Tools menu of the form you are designing, select Forms and click Run This Form. To switch back to design mode, close the new form and you will be back to the form in design mode.


run time

The environment, also called run mode, when the form appears as it looks when being used and when code is running. During run mode, you interact with the macros as a user would.

To begin designing a form, open a new form of the type you would like to design, such as a Mail Message or Contact. On the Tools menu of the new form, select Forms and click Design This Form. If you would like to design a different type of form, with the original form open, on the Tools menu of the form, select Forms and click Design Form. Choose the form you would like to design.

To switch between design mode and run mode, on the Tools menu of the form you are designing, select Forms and click Run This Form. To switch back to design mode, close the new form and you will be back to the form in design mode.


cursor

A piece of software that returns rows of data to the application. A cursor on a result set indicates the current position in the result set.


cleared
clear

To change a setting to "off" or remove a value.


design time

The design environment for Outlook Forms, also called design mode, is when the designer creates the form. A form in design time shows the word {Design} to the right of the form name in the title bar.

Design time is sometimes referred to as the Outlook Form Designer, but this term is misleading. The ability to design forms does not require the installation of a separate product .

To begin designing a form, open a new form of the type you would like to design, such as a Mail Message or Contact. On the Tools menu of the new form, select Forms and click Design This Form. If you would like to design a different type of form, with the original form open, on the Tools menu of the form, select Forms and click Design Form. Choose the form you would like to design.

To switch between design mode and run mode, on the Tools menu of the form you are designing, select Forms and click Run This Form. To switch back to design mode, close the new form and you will be back to the form in design mode.


cycle

To move through a group of objects in a defined order.


context ID

A unique number or string that corresponds to a specific object in an application. Context IDs are used to create links between the application and corresponding Help topics.


Input Method Editor (IME)

An application that translates what you type into characters of a DBCS language, such as Japanese or Chinese. As the user types, the IME displays possible equivalents. The user selects the most appropriate entry.


class

The formal definition of an object. The class acts as the template from which an instance of an object is created at run time. The class defines the properties of the object and the methods used to control the object's behavior.


placeholder

A character that masks or hides another character for security reasons. For example, when a user types a password, an asterisk is displayed on the screen to take the place of each character typed.


property page

A grouping of properties presented as a tabbed page of a property sheet.


caption

Descriptive text that appears directly on or around a control.


class identifier (CLSID)

A unique identifier (UUID) that identifies an object. An object registers its CLSID in the system registration database so the object can be loaded and programmed by other applications.


session

A period of time during which a client uses the messaging system to do some work. A session has a beginning; when a client logs on, a middle; when the client will obtain interfaces, make method calls, and maybe interact with the user, and an end; when a client logs off.


submitted

Submission causes the store provider to place the message in its outgoing queue where it gets picked up by the spooler and handed to one or more transport providers for delivery. A message is always created and submitted in a folder, usually the Outbox.


Assistant

The Assistant is the shared Office Assistant object. It is a fully programmable object.  There’s no collection for the Assistant object; only one Assistant object can be active at a time. For more information about the Assistant object, in the VBA object browser, choose the Assistant object in the Office library, right-click and select the Help icon.


About the order of events

The following events occur in the order specified when a user completes an action.

When	Events
A form is opened to compose an item.	Open
An item is sent.	Send Write Close
An item is posted.	Write Close
An item is saved.	Write
An item is closed.	Close
An item is opened in a folder.	Read Open
A user replies to an item’s sender.	Reply
A user replies to an item’s sender and all recipients.	ReplyAll
The newly-created item is passed to the procedure after the user selects the Forward action for an item.	Forward
One of the item’s standard properties is changed.	PropertyChange
One of the item’s custom properties is changed.	CustomPropertyChange
A user-defined action is initiated.	CustomAction
The Click event occurs only when you have defined it for a control in the Script Editor.


Click Event

The Click event only occurs if it has been defined for a control in the Script Editor.

The Click event occurs in one of two cases:

•	The user clicks a control with the mouse.

•	The user definitively selects a value for a control with more than one possible value.

Syntax

For MultiPage, TabStrip
Sub object_Click(index As Long)

For all other controls
Sub object_Click( )

The Click event syntax has these parts:

Part	Description
object	Required. A valid object.
index	Required. The index of the page or tab in a MultiPage or TabStrip associated with this event.
Remarks

Of the two cases where the Click event occurs, the first case applies to the CommandButton, Frame, Image, Label, ScrollBar, and SpinButton. The second case applies to the CheckBox, ComboBox, ListBox, MultiPage, TabStrip, and ToggleButton. It also applies to an OptionButton when the value changes to True.

The following are examples of actions that initiate the Click event:

•	Clicking a blank area of a form or a disabled control (other than a list box) on the form.

•	Clicking a CommandButton.

•	Pressing the SPACEBAR when a CommandButton has the focus.

•	Clicking a control with the left mouse button (left-clicking).

•	Pressing ENTER on a form that has a command button whose Default property is set to True, as long as no other command button has the focus.

•	Pressing ESC on a form that has a command button whose Cancel property is set to True, as long as no other command button has the focus.

•	Pressing a control's accelerator key.

For some controls, the Click event occurs when the Value property changes. However, using the Change event is the preferred technique for detecting a new value for a property. The following are examples of actions that initiate the Click event due to assigning a new value to a control:

•	Clicking a different page or tab in a MultiPage or TabStrip. The Value property for these controls reflects the current Page or Tab. Clicking the current page or tab does not change the control’s value and does not initiate the Click event.

•	Clicking a CheckBox or ToggleButton, pressing the SPACEBAR when one of these controls has the focus, pressing the accelerator key for one of these controls, or changing the value of the control in code.

•	Changing the value of an OptionButton to True. Setting one OptionButton in a group to True sets all other buttons in the group to False, but the Click event occurs only for the button whose value changes to True.

•	Selecting a value for a ComboBox or ListBox so that it unquestionably matches an item in the control’s drop-down list. For example, if a list is not sorted, the first match for characters typed in the edit region may not be the only match in the list, so choosing such a value does not initiate the Click event. In a sorted list, you can use entry-matching to ensure that a selected value is a unique match for text the user types.

The Click event is not initiated when Value is set to Null.

Note  Left-clicking changes the value of a control, thus it initiates the Click event. Right-clicking does not change the value of the control, so it does not initiate the Click event.


Item Method Example

The following example uses the Item method to access individual members of the Controls and Pages collections. The user chooses an option button for either the Controls collection or the MultiPage, and then clicks the CommandButton. The name of the appropriate control is returned in the Label.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A CommandButton named CommandButton1.

•	A Label named Label1.

•	Two OptionButton controls named OptionButton1 and OptionButton2.

•	A MultiPage named MultiPage1.

Dim ControlsIndex

Sub CommandButton1_Click()

Set Controls = Item.GetInspector.ModifiedFormPages("P.2").Controls

Set OptionButton1 = Controls("OptionButton1")

Set OptionButton2 = Controls("OptionButton2")

Set Label1 = Controls("Label1")

Set MultiPage1 = Controls("MultiPage1")

    If OptionButton1.Value = True Then

        'Process Controls collection for UserForm

        Set MyControl = Controls.Item(ControlsIndex)

        Label1.Caption = MyControl.Name

        'Prepare index for next control on Userform

        ControlsIndex = ControlsIndex + 1

        If ControlsIndex >= Controls.Count Then

            ControlsIndex = 0

        End If

    ElseIf OptionButton2.Value = True Then

        'Process Current Page of Pages collection

        Set MyControl = MultiPage1.Pages.Item(MultiPage1.Value)

        Label1.Caption = MyControl.Name

    End If

End Sub

Sub Item_Open()

    ControlsIndex = 0

Set OptionButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton1")

Set OptionButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton2")

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton1")

    OptionButton1.Caption = "Controls Collection"

    OptionButton2.Caption = "Pages Collection"

    OptionButton1.Value = True

    CommandButton1.Caption = "Get Member Name"

End Sub


Object Property Example

Assume a new control has a Top property that is different from the standard Top property in Microsoft Forms. You can use either property, based on the syntax:

•	control.Top uses the standard Top property.

•	control.Object.Top uses the Top property from the added control.


TabStop Property Example

The following example uses the TabStop property to control whether a user can press TAB to move the focus to a particular control. The user presses TAB to move the focus among the controls on the form, and then clicks the ToggleButton to change TabStop for CommandButton1. When TabStop is False, CommandButton1 will not receive the focus by using TAB.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A CommandButton named CommandButton1.

•	A ToggleButton named ToggleButton1.

•	One or two other controls, such as an OptionButton or ListBox.

Sub CommandButton1_Click()

    MsgBox "Clicked CommandButton1."

End Sub

Sub ToggleButton1_Click()

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton1")

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton1")

    If ToggleButton1 = True Then

        CommandButton1.TabStop = True

        ToggleButton1.Caption = "TabStop On"

    Else

        CommandButton1.TabStop = False

        ToggleButton1.Caption = "TabStop Off"

    End If

End Sub

Sub Item_Open()

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton1")

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton1")

    CommandButton1.Caption = "Show Message"

    ToggleButton1.Caption = "TabStop On"

    ToggleButton1.Value = True

    ToggleButton1.Width = 90

End Sub


TakeFocusOnClick Property Example

The following example uses the TakeFocusOnClick property to control whether a CommandButton receives the focus when the user clicks on it. The user clicks a control other than CommandButton1 and then clicks CommandButton1. If TakeFocusOnClick is True, CommandButton1 receives the focus after it is clicked. The user can change the value of TakeFocusOnClick by clicking the ToggleButton.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A CommandButton named CommandButton1.

•	A ToggleButton named ToggleButton1.

•	One or two other controls, such as an OptionButton or ListBox.

Sub CommandButton1_Click()

    MsgBox "Watch CommandButton1 to see if it takes the focus."

End Sub

Sub ToggleButton1_Click()

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton1")

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton1")

    If ToggleButton1 = True Then

        CommandButton1.TakeFocusOnClick = True

        ToggleButton1.Caption = "TakeFocusOnClick On"

    Else

        CommandButton1.TakeFocusOnClick = False

        ToggleButton1.Caption = "TakeFocusOnClick Off"

    End If

End Sub

Sub Item_Open()

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton1")

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton1")

    CommandButton1.Caption = "Show Message"

    ToggleButton1.Caption = "TakeFocusOnClick On"

    ToggleButton1.Value = True

    ToggleButton1.Width = 90

End Sub


MatchEntry Property Example

The following example uses the MatchEntry property to demonstrate character matching that is available for ComboBox and ListBox. In this example, the user can set the type of matching with the OptionButton controls and then type into the ComboBox to specify an item from its list.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	Three OptionButton controls named OptionButton1 through OptionButton3.

•	A ComboBox named ComboBox1.

Sub OptionButton1_Click()

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

    ComboBox1.MatchEntry = 2	'2=fmMatchEntryNone

End Sub

Sub OptionButton2_Click()

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

    ComboBox1.MatchEntry = 0	'0=fmMatchEntryFirstLetter

End Sub

Sub OptionButton3_Click()

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

        ComboBox1.MatchEntry = 1	'1=fmMatchEntryComplete

End Sub

Sub Item_Open()

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

Set OptionButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton1")

Set OptionButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton2")

Set OptionButton3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton3")

    For i = 1 To 9

        ComboBox1.AddItem "Choice " & i

    Next

    ComboBox1.AddItem "Chocoholic"

    OptionButton1.Caption = "No matching"

    OptionButton1.Value = True

    OptionButton2.Caption = "Basic matching"

    OptionButton3.Caption = "Extended matching"

End Sub


MatchFound, MatchRequired Properties Example

The following example uses the MatchFound and MatchRequired properties to demonstrate additional character matching for ComboBox. The matching verification occurs in the Change event.

In this example, the user specifies whether the text portion of a ComboBox must match one of the listed items in the ComboBox. The user can specify whether matching is required by using a CheckBox and then type into the ComboBox to specify an item from its list.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A ComboBox named ComboBox1 that is bound to the Subject field.

•	A CheckBox named CheckBox1.

Sub CheckBox1_Click()

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

Set CheckBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CheckBox1")

    If CheckBox1.Value = True Then

        ComboBox1.MatchRequired = True

        MsgBox "To move the focus from the ComboBox, you must match an entry in the list or press ESC."

    Else

        ComboBox1.MatchRequired = False

        MsgBox " To move the focus from the ComboBox, just tab to or click another control. Matching is optional."

    End If

End Sub

Sub Item_PropertyChange(byval pname)

if pname = "Subject" then

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

    If ComboBox1.MatchRequired = True Then

    'MSForms handles this case automatically

    Else

        If ComboBox1.MatchFound = True Then

            MsgBox "Match Found; matching optional."

        Else

            MsgBox "Match not Found; matching optional."

        End If

    End If

end if

End Sub

Sub Item_Open()

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

Set CheckBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CheckBox1")

For i = 1 To 9

   	 ComboBox1.AddItem "Choice " & i

Next

ComboBox1.AddItem "Chocoholic"

CheckBox1.Caption = "MatchRequired"

CheckBox1.Value = True

End Sub


MultiSelect, Selected Properties Example

The following example uses the MultiSelect and Selected properties to demonstrate how the user can select one or more items in a ListBox. The user specifies a selection method by choosing an option button and then selects an item(s) from the ListBox. The user can display the selected items in a second ListBox by clicking the CommandButton.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	Two ListBox controls named ListBox1 and ListBox2.

•	A CommandButton named CommandButton1.

•	Three OptionButton controls named OptionButton1 through OptionButton3.

Sub CommandButton1_Click()

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

Set ListBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox2")

    ListBox2.Clear

    For i = 0 To 9

        If ListBox1.Selected(i) = True Then

            ListBox2.AddItem ListBox1.List(i)

        End If

    Next

End Sub

Sub OptionButton1_Click()

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

    ListBox1.MultiSelect = 0	'0=fmMultiSelectSingle

End Sub

Sub OptionButton2_Click()

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

    ListBox1.MultiSelect = 1	'1=fmMultiSelectMulti

End Sub

Sub OptionButton3_Click()

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

    ListBox1.MultiSelect = 2	'2=fmMultiSelectExtended

End Sub

Sub Item_Open()

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

Set OptionButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton1")

Set OptionButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton2")

Set OptionButton3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton3")

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton1")

    For i = 0 To 9

        ListBox1.AddItem "Choice " & (ListBox1.ListCount + 1)

    Next

    OptionButton1.Caption = "Single Selection"

    ListBox1.MultiSelect = 0	'0=fmMultiSelectSingle

    OptionButton1.Value = True

    OptionButton2.Caption = "Multiple Selection"

    OptionButton3.Caption = "Extended Selection"

    CommandButton1.Caption = "Show selections"

    CommandButton1.AutoSize = True

End Sub


Style Property Example for ComboBox

The following example uses the Style property to change the effect of typing in the text area of a ComboBox. The user chooses a style by selecting an OptionButton control and then types into the ComboBox to select an item. When Style is StyleDropDownList, the user must choose an item from the drop-down list. When Style is StyleDropDownCombo, the user can type into the text area to specify an item in the drop-down list.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	Two OptionButton controls named OptionButton1 and OptionButton2.

•	A ComboBox named ComboBox1.

Sub OptionButton1_Click()

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

    ComboBox1.Style = 0	'0=fmStyleDropDownCombo

End Sub

Sub OptionButton2_Click()

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

    ComboBox1.Style = 2	'2=fmStyleDropDownList

End Sub

Sub Item_Open()

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

Set OptionButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton1")

Set OptionButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton2")

    For i = 1 To 10

        ComboBox1.AddItem "Choice " & i

    Next

    OptionButton1.Caption = "Select like ComboBox"

    OptionButton1.Value = True

    ComboBox1.Style = 0	'0=fmStyleDropDownCombo

    OptionButton2.Caption = "Select like ListBox"

End Sub


Style Property Example for MultiPage and TabStrip

The following example uses the Style property to specify the appearance of the tabs in MultiPage and TabStrip. This example also demonstrates using a Label. The user chooses a style by selecting an OptionButton.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A Label named Label1.

•	Three OptionButton controls named OptionButton1 through OptionButton3.

•	A MultiPage named MultiPage1.

•	A TabStrip named TabStrip1.

•	Any control inside the TabStrip.

•	Any control in each page of the MultiPage.

Sub OptionButton1_Click()

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

Set TabStrip1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TabStrip1")

    MultiPage1.Style = 0	'0=fmTabStyleTabs

    TabStrip1.Style = 0	'0=fmTabStyleTabs

End Sub

Sub OptionButton2_Click()

    'Note that the page borders are invisible

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

Set TabStrip1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TabStrip1")

    MultiPage1.Style = 1	'1=fmTabStyleButtons

    TabStrip1.Style = 1	'1=fmTabStyleButtons

End Sub

Sub OptionButton3_Click()

    'Note that the page borders are invisible and

    'the page body begins where the tabs normally appear.

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

Set TabStrip1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TabStrip1")

    MultiPage1.Style = 2	'2=fmTabStyleNone

    TabStrip1.Style = 2	'2=fmTabStyleNone

End Sub

Sub Item_Open()

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1")

Set OptionButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton1")

Set OptionButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton2")

Set OptionButton3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton3")

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

Set TabStrip1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TabStrip1")

    Label1.Caption = "Page/Tab Style"

    OptionButton1.Caption = "Tabs"

    OptionButton1.Value = True

    MultiPage1.Style = 0	'0=fmTabStyleTabs

    TabStrip1.Style = 0	'0=fmTabStyleTabs

    OptionButton2.Caption = "Buttons"

    OptionButton3.Caption = "No Tabs or Buttons"

End Sub


TabFixedHeight, TabFixedWidth Properties Example

The following example uses the TabFixedHeight and TabFixedWidth properties to set the size of the tabs used in MultiPage and TabStrip. The user clicks the SpinButton controls to adjust the height and width of the tabs within the MultiPage and TabStrip.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A MultiPage named MultiPage1.

•	A TabStrip named TabStrip1.

•	A Label named Label1 for the width control.

•	A SpinButton named SpinButton1 for the width control that is bound to a custom number field named SpinButtonWidth.

•	A TextBox named TextBox1 for the width control.

•	A Label named Label2 for the height control.

•	A SpinButton named SpinButton2 for the height control that is bound to a custom number field named SpinButtonHeight.

•	A TextBox named TextBox2 for the height control.

Sub UpdateTabWidth()

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set SpinButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("SpinButton1")

Set TabStrip1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TabStrip1")

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

    TextBox1.Text = SpinButton1.Value

    TabStrip1.TabFixedWidth = SpinButton1.Value

    MultiPage1.TabFixedWidth = SpinButton1.Value

End Sub

Sub UpdateTabHeight()

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox2")

Set SpinButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("SpinButton2")

Set TabStrip1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TabStrip1")

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

    TextBox2.Text = SpinButton2.Value

    TabStrip1.TabFixedHeight = SpinButton2.Value

    MultiPage1.TabFixedHeight = SpinButton2.Value

End Sub

Sub Item_Open()

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox2")

Set SpinButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("SpinButton1")

Set SpinButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("SpinButton2")

Set TabStrip1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TabStrip1")

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1")

Set Label2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label2")

    MultiPage1.Style = 1	'1=fmTabStyleButtons

    Label1.Caption = "Tab Width"

    SpinButton1.Min = 0

    SpinButton1.Max = TabStrip1.Width / TabStrip1.Tabs.Count

    SpinButton1.Value = 0

    TextBox1.Locked = True

    UpdateTabWidth

    Label2.Caption = "Tab Height"

    SpinButton2.Min = 0

    SpinButton2.Max = TabStrip1.Height

    SpinButton2.Value = 0

    TextBox2.Locked = True

    UpdateTabHeight

End Sub

Sub Item_CustomPropertyChange(byval pname)

'msgbox pname

If pname = "SpinButtonWidth" Then

UpdateTabWidth

ElseIf pname = "SpinButtonHeight" Then

UpdateTabHeight

End If

End Sub


TabIndex Property Example

The following example uses the TabIndex property to display and set the tab order for individual controls. The user can press TAB to reach the next control in the tab order and to display the TabIndex of that control. The user can also click on any control, except a TextBox or ScrollBar, to display its TabIndex. The user can change the TabIndex of a control by specifying a new index value in the TextBox and clicking CommandButton3. Changing the TabIndex for one control also updates the TabIndex for other controls in the Frame.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A Label named Label1.

•	A TextBox named TextBox1.

•	A Frame named Frame1.

•	A TextBox in the Frame named TextBox2.

•	Two CommandButton controls in the Frame named CommandButton1 and CommandButton2.

•	A ScrollBar in the Frame named ScrollBar1.

•	A CommandButton (not in the Frame) named CommandButton3.

Sub MoveToFront()

Set Frame1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Frame1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

    Temp = Frame1.ActiveControl.TabIndex

    For i = 0 To Temp - 1

        Frame1.Controls.Item(i).TabIndex = i + 1

    Next

    Frame1.ActiveControl.TabIndex = 0

    TextBox1.Text = Frame1.ActiveControl.TabIndex

End Sub

Sub CommandButton3_Click()

Set Frame1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Frame1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

    If IsNumeric(TextBox1.Text) Then

        Temp = CInt(TextBox1.Text)

        If Temp >= Frame1.Controls.Count Or Temp < 0 Then

            'Entry out of range; move control to front of tab order

            MoveToFront

        ElseIf Temp > Frame1.ActiveControl.TabIndex Then

            'Move entry down the list

            For i = Frame1.ActiveControl.TabIndex + 1 To Temp

                Frame1.Controls.Item(i).TabIndex = i - 1

            Next

            Frame1.ActiveControl.TabIndex = Temp

            TextBox1.Text = Frame1.ActiveControl.TabIndex

        Else

            'Move Entry up the list

            For i = Frame1.ActiveControl.TabIndex - 1 To Temp

                Frame1.Controls.Item(i).TabIndex = i + 1

            Next

            Frame1.ActiveControl.TabIndex = Temp

            TextBox1.Text = Frame1.ActiveControl.TabIndex

        End If

    Else

        'Text entry; move control to front of tab order

        MoveToFront

    End If

End Sub

Sub Item_Open()

Set Frame1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Frame1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1")

Set CommandButton3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton3")

    Label1.Caption = "TabIndex"

    Frame1.Controls(0).SetFocus

    TextBox1.Text = Frame1.ActiveControl.TabIndex

    Frame1.Cycle = 2	'2=fmCycleCurrentForm

    CommandButton3.Caption = "Set TabIndex"

    CommandButton3.TakeFocusOnClick = False

End Sub

Sub CommandButton1_Click()

Set Frame1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Frame1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

    TextBox1.Text = Frame1.ActiveControl.TabIndex

End Sub

Sub CommandButton2_Click()

Set Frame1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Frame1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

    TextBox1.Text = Frame1.ActiveControl.TabIndex

End Sub


Tag Property Example

The following example uses the Tag property to store additional information about each control on the UserForm. The user clicks a control and then clicks the CommandButton. The contents of Tag for the appropriate control are returned in the TextBox.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A TextBox named TextBox1.

•	A CommandButton named CommandButton1.

•	A ScrollBar named ScrollBar1.

•	A ComboBox named ComboBox1.

•	A MultiPage named MultiPage1.

Sub CommandButton1_Click()

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set MultiPage1= Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

    TextBox1.Text = Item.GetInspector.ModifiedFormPages("P.2").ActiveControl.Tag

End Sub

Sub Item_Open()

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set CommandButton1= Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton1")

Set ComboBox1= Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

Set ScrollBar1= Item.GetInspector.ModifiedFormPages("P.2").Controls("ScrollBar1")

Set MultiPage1= Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

    TextBox1.Locked = True

    TextBox1.Tag = "Display area for Tag properties."

    TextBox1.AutoSize = True

    CommandButton1.Caption = "Show Tag of Current Control."

    CommandButton1.AutoSize = True

    CommandButton1.WordWrap = True

    CommandButton1.TakeFocusOnClick = False

    CommandButton1.Tag = "Shows tag of control that has the focus."

    ComboBox1.Style = fmStyleDropDownList

    ComboBox1.Tag = "ComboBox Style is that of a ListBox."

    ScrollBar1.Max = 100

    ScrollBar1.Min = -273

    ScrollBar1.Tag = "Max = " & ScrollBar1.Max & " , Min = " & ScrollBar1.Min

    MultiPage1.Pages.Add

    MultiPage1.Pages.Add

    MultiPage1.Tag = "This MultiPage has " & MultiPage1.Pages.Count & " pages."

End Sub


TopIndex Property Example

The following example identifies the top item displayed in a ListBox and the item that has the focus within the ListBox. This example uses the TopIndex property to identify the item displayed at the top of the ListBox and the ListIndex property to identify the item that has the focus. The user selects an item in the ListBox. The displayed values of TopIndex and ListIndex are updated when the user selects an item or when the user clicks the CommandButton.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A Label named Label1.

•	A TextBox named TextBox1.

•	A Label named Label2.

•	A TextBox named TextBox2.

•	A CommandButton named CommandButton1.

•	A ListBox named ListBox1 that is bound to the Subject field.

Sub CommandButton1_Click()

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox2")

    ListBox1.TopIndex = ListBox1.ListIndex

    TextBox1.Text = ListBox1.TopIndex

    TextBox2.Text = ListBox1.ListIndex

End Sub

Sub Item_PropertyChange(byval pname)

if pname = "Subject" then

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox2")

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

    TextBox1.Text = ListBox1.TopIndex

    TextBox2.Text = ListBox1.ListIndex

end if

End Sub

Sub Item_Open()

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox2")

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1")

Set Label2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label2")

    For i = 0 To 24

        ListBox1.AddItem "Choice " & (i + 1)

    Next

    ListBox1.Height = 66

    CommandButton1.Caption = "Move to top of list"

    CommandButton1.AutoSize = True

    CommandButton1.TakeFocusOnClick = False

    Label1.Caption = "Index of top item"

    TextBox1.Text = ListBox1.TopIndex

    Label2.Caption = "Index of current item"

    Label2.AutoSize = True

    Label2.WordWrap = False

    TextBox2.Text = ListBox1.ListIndex

End Sub


TripleState Property Example

The following example uses the TripleState property to allow Null as a legal value of a CheckBox and a ToggleButton. The user controls the value of TripleState through ToggleButton2. The user can set the value of a CheckBox or ToggleButton based on the value of TripleState. However, when a control is set to Null, no event is fired.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A CheckBox named CheckBox1.

•	A ToggleButton named ToggleButton1.

•	A ToggleButton named ToggleButton2.

Sub Item_Open()

Set CheckBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CheckBox1")

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton1")

Set ToggleButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton2")

    CheckBox1.Caption = "Value is True"

    CheckBox1.Value = True

    CheckBox1.TripleState = False

    ToggleButton1.Caption = "Value is True"

    ToggleButton1.Value = True

    ToggleButton1.TripleState = False

    ToggleButton2.Value = False

    ToggleButton2.Caption = "Triple State Off"

End Sub

Sub ToggleButton2_Click()

Set CheckBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CheckBox1")

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton1")

Set ToggleButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton2")

    If ToggleButton2.Value = True Then

        ToggleButton2.Caption = "Triple State On"

        CheckBox1.TripleState = True

        ToggleButton1.TripleState = True

    Else

        ToggleButton2.Caption = "Triple State Off"

        CheckBox1.TripleState = False

        ToggleButton1.TripleState = False

    End If

End Sub

Sub CheckBox1_Click()

Set CheckBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CheckBox1")

    If IsNull(CheckBox1.Value) Then

        CheckBox1.Caption = "Value is Null"

    ElseIf CheckBox1.Value = False Then

        CheckBox1.Caption = "Value is False"

    ElseIf CheckBox1.Value = True Then

        CheckBox1.Caption = "Value is True"

    End If

End Sub

Sub ToggleButton1_Click()

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton1")

    If IsNull(ToggleButton1.Value) Then

        ToggleButton1.Caption = "Value is Null"

    ElseIf ToggleButton1.Value = False Then

        ToggleButton1.Caption = "Value is False"

    ElseIf ToggleButton1.Value = True Then

        ToggleButton1.Caption = "Value is True"

    End If

End Sub


Value Property Example

The following example demonstrates the values that the different types of controls can have by displaying the Value property of a selected control. The user chooses a control by pressing TAB or by clicking on the control. Depending on the type of control, the user can also specify a value for the control by typing in the text area of the control, by clicking one or more times on the control, or by selecting an item, page, or tab within the control. The user can display the value of the selected control by clicking the appropriately labeled CommandButton.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A CommandButton named CommandButton1.

•	A TextBox named TextBox1.

•	A CheckBox named CheckBox1.

•	A ComboBox named ComboBox1.

•	A CommandButton named CommandButton2.

•	A ListBox named ListBox1.

•	A MultiPage named MultiPage1.

•	Two OptionButton controls named OptionButton1 and OptionButton2.

•	A ScrollBar named ScrollBar1.

•	A SpinButton named SpinButton1.

•	A TabStrip named TabStrip1.

•	A TextBox named TextBox2.

•	A ToggleButton named ToggleButton1.

Sub CommandButton1_Click()

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set Form = Item.GetInspector.ModifiedFormPages("P.2")

     TextBox1.Text = "Value of " & Form.ActiveControl.Name & " is " & 	Form.ActiveControl.Value

End Sub

Sub Item_Open()

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

Set CheckBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CheckBox1")

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton1")

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox2")

    CommandButton1.Caption = "Get value of current control"

    CommandButton1.AutoSize = True

    CommandButton1.TakeFocusOnClick = False

    CommandButton1.TabStop = False

    TextBox1.AutoSize = True

    For i = 0 To 10

        ComboBox1.AddItem "Choice " & (i + 1)

        ListBox1.AddItem "Selection " & (100 - i)

    Next

    CheckBox1.TripleState = True

    ToggleButton1.TripleState = True

    TextBox2.Text = "Enter text here."

End Sub


Max, Min, MaxLength Properties Example

The following example demonstrates the Max and Min properties when used with a stand-alone ScrollBar. The user can set the Max and Min values to any integer in the range of –1000 to 1000. This example also uses the MaxLength property to restrict the number of characters entered for the Max and Min values.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A Label named Label1

•	A TextBox named TextBox1 that is bound to the custom number field named ScrollBarMin.

•	A Label named Label2

•	A TextBox named TextBox2 that is bound to the custom number field named ScrollBarMax.

•	A ScrollBar named ScrollBar1 that is bound to the custom number field named ScrollBarValue.

•	A Label named Label3.

Sub Item_Open()

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1")

Set ScrollBar1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ScrollBar1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set Label2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label2")

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox2")

Set Label3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label3")

    Label1.Caption = "Min -1000 to 1000"

    ScrollBar1.Min = -1000

    TextBox1.Text = ScrollBar1.Min

    TextBox1.MaxLength = 5

    Label2.Caption = "Max -1000 to 1000"

    ScrollBar1.Max = 1000

    TextBox2.Text = ScrollBar1.Max

    TextBox2.MaxLength = 5

    ScrollBar1.SmallChange = 1

    ScrollBar1.LargeChange = 100

    ScrollBar1.Value = 0

    Label3.Caption = ScrollBar1.Value

End Sub

Sub Item_CustomPropertyChange(byval pname)

Set ScrollBar1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ScrollBar1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox2")

Set Label3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label3")

If pname = "ScrollBarMin" Then

    If IsNumeric(TextBox1.Text) Then

   	     TempNum = CInt(TextBox1.Text)

        If TempNum >= -1000 And TempNum <= 1000 Then

   	         ScrollBar1.Min = TempNum

      	  Else

         	   TextBox1.Text = ScrollBar1.Min

        End If

   	 Else

      	  TextBox1.Text = ScrollBar1.Min

    End If

ElseIf pname = "ScrollBarMax" Then

    If IsNumeric(TextBox2.Text) Then

   	     TempNum = CInt(TextBox2.Text)

      	  If TempNum >= -1000 And TempNum <= 1000 Then

         	   ScrollBar1.Max = TempNum

        Else

   	         TextBox2.Text = ScrollBar1.Max

      	  End If

    Else

   	     TextBox2.Text = ScrollBar1.Max

    End If

ElseIf pname = "ScrollBarValue" Then

Label3.Caption = ScrollBar1.Value

End If

End Sub


LargeChange, SmallChange Properties Example

The following example demonstrates the LargeChange and SmallChange properties when used with a stand-alone ScrollBar. The user can set the LargeChange and SmallChange values to any integer in the range of 0 to 100. This example also uses the MaxLength property to restrict the number of characters entered for the LargeChange and SmallChange values.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A Label named Label1

•	A TextBox named TextBox1 that is bound to the custom number field named ScrollBarSmallChange

•	A Label named Label2

•	A TextBox named TextBox2 that is bound to the custom number field named ScrollBarLargeChange.

•	A ScrollBar named ScrollBar1 that is bound to the custom number field named ScrollBarValue.

•	A Label named Label3.

Sub Item_Open()

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1")

Set ScrollBar1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ScrollBar1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set Label2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label2")

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox2")

Set Label3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label3")

    ScrollBar1.Min = -1000

    ScrollBar1.Max = 1000

    Label1.Caption = "SmallChange 0 to 100"

    ScrollBar1.SmallChange = 1

    TextBox1.Text = ScrollBar1.SmallChange

    TextBox1.MaxLength = 3

    Label2.Caption = "LargeChange 0 to 100"

    ScrollBar1.LargeChange = 100

    TextBox2.Text = ScrollBar1.LargeChange

    TextBox2.MaxLength = 3

    ScrollBar1.Value = 0

    Label3.Caption = ScrollBar1.Value

End Sub

Sub Item_CustomPropertyChange(byval pname)

Set ScrollBar1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ScrollBar1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox2")

Set Label3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label3")

If pname = "ScrollBarMin" Then

    If IsNumeric(TextBox1.Text) Then

        TempNum = CInt(TextBox1.Text)

        If TempNum >= 0 And TempNum <= 100 Then

            ScrollBar1.SmallChange = TempNum

        Else

            TextBox1.Text = ScrollBar1.SmallChange

        End If

    Else

        TextBox1.Text = ScrollBar1.SmallChange

    End If

ElseIf pname = "ScrollBarMax" Then

    If IsNumeric(TextBox2.Text) Then

        TempNum = CInt(TextBox2.Text)

        If TempNum >= 0 And TempNum <= 100 Then

            ScrollBar1.LargeChange = TempNum

        Else

            TextBox2.Text = ScrollBar1.LargeChange

        End If

    Else

        TextBox2.Text = ScrollBar1.LargeChange

    End If

ElseIf pname = "ScrollBarValue" Then

Label3.Caption = ScrollBar1.Value

End If

End Sub


ScrollBars, KeepScrollBarsVisible Properties Example

The following example uses the ScrollBars and the KeepScrollBarsVisible properties to add scroll bars to a page of a MultiPage and to a Frame. The user chooses an option button that, in turn, specifies a value for KeepScrollBarsVisible.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A MultiPage named MultiPage1.

•	A Frame named Frame1.

•	Four OptionButton controls named OptionButton1 through OptionButton4.

Sub Item_Open()

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

Set Frame1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Frame1")

Set OptionButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton1")

Set OptionButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton2")

Set OptionButton3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton3")

Set OptionButton4 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton4")

    MultiPage1.Pages(0).ScrollBars = 3	'3=fmScrollBarsBoth

    MultiPage1.Pages(0).KeepScrollBarsVisible = 0	'0=fmScrollBarsNone

    Frame1.ScrollBars = 3	'3=fmScrollBarsBoth

    Frame1.KeepScrollBarsVisible = 0	'0=fmScrollBarsNone

    OptionButton1.Caption = "No scroll bars"

    OptionButton1.Value = True

    OptionButton2.Caption = "Horizontal scroll bars"

    OptionButton3.Caption = "Vertical scroll bars"

    OptionButton4.Caption = "Both scroll bars"

End Sub

Sub OptionButton1_Click()

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

Set Frame1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Frame1")

    MultiPage1.Pages(0).KeepScrollBarsVisible = 0	'0=fmScrollBarsNone

    Frame1.KeepScrollBarsVisible = 0	'0=fmScrollBarsNonefmScrollBarsNone

End Sub

Sub OptionButton2_Click()

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

Set Frame1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Frame1")

    MultiPage1.Pages(0).KeepScrollBarsVisible = 1	'1=fmScrollBarsHorizontal

    Frame1.KeepScrollBarsVisible = 1	'1=fmScrollBarsHorizontal

End Sub

Sub OptionButton3_Click()

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

Set Frame1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Frame1")

    MultiPage1.Pages(0).KeepScrollBarsVisible = 2	'2=fmScrollBarsVertical

    Frame1.KeepScrollBarsVisible = 2	'2=fmScrollBarsVertical

End Sub

Sub OptionButton4_Click()

Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("MultiPage1")

Set Frame1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Frame1")

    MultiPage1.Pages(0).KeepScrollBarsVisible = 3	'3=fmScrollBarsBoth

    Frame1.KeepScrollBarsVisible = 3	'3=fmScrollBarsBoth

End Sub


InsideHeight, InsideWidth Properties Example

The following example uses the InsideHeight and InsideWidth properties to resize a CommandButton. The user clicks the CommandButton to resize it.

Note   InsideHeight and InsideWidth are read-only properties.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A CommandButton named CommandButton1.

Dim Resize

Sub Item_Open()

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton1")

    Resize = 0.75

    CommandButton1.Caption = "Resize Button"

End Sub

Sub CommandButton1_Click()

Set Form = Item.GetInspector.ModifiedFormPages("P.2")

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("CommandButton1")

    CommandButton1.Move 10, 10, Form.InsideWidth * Resize, Form.InsideHeight * Resize

    CommandButton1.Caption = "Button resized using InsideHeight and InsideWidth!"

End Sub


ListRows Property Example

The following example uses a SpinButton to control the number of rows in the drop-down list of a ComboBox. The user changes the value of the SpinButton, then clicks on the drop-down arrow of the ComboBox to display the list.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A ComboBox named ComboBox1.

•	A SpinButton named SpinButton1 that is bound to a custom number field named SpinButtonValue.

•	A Label named Label1.

Sub Item_Open()

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

Set SpinButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("SpinButton1")

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1")

    For i = 1 To 20

        ComboBox1.AddItem "Choice " & (ComboBox1.ListCount + 1)

    Next

    SpinButton1.Min = 0

    SpinButton1.Max = 12

    SpinButton1.Value = ComboBox1.ListRows

    Label1.Caption = "ListRows = " & SpinButton1.Value

End Sub

Sub Item_CustomPropertyChange(byval pname)

If pname = "SpinButtonValue" Then

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

Set SpinButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("SpinButton1")

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1")

   	 ComboBox1.ListRows = SpinButton1.Value

    Label1.Caption = "ListRows = " & SpinButton1.Value

End If

End Sub


ListWidth Property Example

The following example uses a SpinButton to control the width of the drop-down list of a ComboBox. The user changes the value of the SpinButton, then clicks on the drop-down arrow of the ComboBox to display the list.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A ComboBox named ComboBox1.

•	A SpinButton named SpinButton1 that is bound to a custom number field named SpinButtonValue.

•	A Label named Label1.

Sub Item_Open()

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

Set SpinButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("SpinButton1")

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1")

    For i = 1 To 20

        ComboBox1.AddItem "Choice " & (ComboBox1.ListCount + 1)

    Next

    SpinButton1.Min = 0

    SpinButton1.Max = 130

'convert listwidth value from '122 pt' to an integer

intpos = instr(combobox1.listwidth," ")

intwidth = left(combobox1.listwidth,intpos-1)

    SpinButton1.Value = intwidth

    SpinButton1.SmallChange = 5

    Label1.Caption = "ListWidth = " & SpinButton1.Value

End Sub

Sub Item_CustomPropertyChange(byval pname)

If pname = "SpinButtonValue" Then

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ComboBox1")

Set SpinButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("SpinButton1")

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1")

    ComboBox1.ListWidth = SpinButton1.Value

    Label1.Caption = "ListWidth = " & SpinButton1.Value

End If

End Sub


ListStyle, MultiSelect Properties Example

The following example uses the ListStyle and MultiSelect properties to control the appearance of a ListBox. The user chooses a value for ListStyle using the ToggleButton and chooses an OptionButton for one of the MultiSelect values. The appearance of the ListBox changes accordingly, as well as the selection behavior within the ListBox.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A ListBox named ListBox1.

•	A Label named Label1.

•	Three OptionButton controls named OptionButton1 through OptionButton3.

•	A ToggleButton named ToggleButton1.

Sub Item_Open()

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1")

Set OptionButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton1")

Set OptionButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton2")

Set OptionButton3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton3")

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton1")

    For i = 1 To 8

        ListBox1.AddItem "Choice" & (ListBox1.ListCount + 1)

    Next

    Label1.Caption = "MultiSelect Choices"

    Label1.AutoSize = True

    ListBox1.MultiSelect = 0	'0=fmMultiSelectSingle

    OptionButton1.Caption = "Single entry"

    OptionButton1.Value = True

    OptionButton2.Caption = "Multiple entries"

    OptionButton3.Caption = "Extended entries"

    ToggleButton1.Caption = "ListStyle - Plain"

    ToggleButton1.Value = True

    ToggleButton1.Width = 90

    ToggleButton1.Height = 30

End Sub

Sub OptionButton1_Click()

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

    ListBox1.MultiSelect = 0	'0=fmMultiSelectSingle

End Sub

Sub OptionButton2_Click()

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

    ListBox1.MultiSelect = 1	'1=fmMultiSelectMulti

End Sub

Sub OptionButton3_Click()

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

    ListBox1.MultiSelect = 2	'2=fmMultiSelectExtended

End Sub

Sub ToggleButton1_Click()

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton1")

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ListBox1")

    If ToggleButton1.Value = True Then

        ToggleButton1.Caption = "Plain ListStyle"

        ListBox1.ListStyle = 0	'0=fmListStylePlain

    Else

        ToggleButton1.Caption = "OptionButton or CheckBox"

        ListBox1.ListStyle = 1	'1=fmListStyleOption

    End If

End Sub


MouseIcon, MousePointer Properties Example

The following example demonstrates how to specify a mouse pointer that is appropriate for a specific control or situation. You can assign one of several available mouse pointers using the MousePointer property.

This example works in the following ways:

•	Choose a mouse pointer from the ListBox to change the mouse pointer associated with the ListBox.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A ListBox named ListBox1.

Dim ListBox1

Sub Item_Open()

set ListBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("ListBox1")

'Load ListBox with MousePointer choices

ListBox1.Clear

ListBox1.AddItem "Default"

ListBox1.AddItem "Arrow"

ListBox1.AddItem "Cross"

ListBox1.AddItem "IBeam"

ListBox1.AddItem "SizeNESW"

ListBox1.AddItem "SizeNS"

ListBox1.AddItem "SizeNWSE"

ListBox1.AddItem "SizeWE"

ListBox1.AddItem "UpArrow"

ListBox1.AddItem "Hourglass"

ListBox1.AddItem "NoDrop"

ListBox1.AddItem "AppStarting"

ListBox1.AddItem "Help"

ListBox1.AddItem "SizeAll"

End Sub

Sub ListBox1_Click()

   If IsNull(ListBox1.Value) = False Then

Select Case ListBox1.Value

Case "Default"

pointer = 0	'Standard pointer.

            Case "Arrow"

pointer = 1	'Arrow.

Case "Cross"

pointer = 2	'Cross-hair pointer.

Case "IBeam"

pointer = 3	'I-beam.

Case "SizeNESW"

pointer = 6	'Double arrow pointing northeast and southwest.

Case "SizeNS"

pointer = 7	'Double arrow pointing north and south.

 	Case "SizeNWSE"

pointer = 8	'Double arrow pointing northwest and southeast.

Case "SizeWE"

pointer = 9	'Double arrow pointing west and east.

Case "UpArrow"

pointer = 10	'Up arrow.

Case "Hourglass"

pointer = 11	'Hourglass.

Case "NoDrop"

pointer = 12	'"Not" symbol (circle with a diagonal line) on top of the object being dragged. Indicates an invalid drop target.

Case "AppStarting"

pointer = 13	'Arrow with an hourglass.

Case "Help"

pointer = 14	'Arrow with a question mark.

Case "SizeAll"

pointer = 15	'Size all cursor (arrows pointing north, south, east, and west).

End Select

ListBox1.MousePointer = pointer

   End If

End Sub


EnterKeyBehavior Property Example

The following example uses the EnterKeyBehavior property to control the effect of ENTER in a TextBox. In this example, the user can specify either a single-line or multiline TextBox.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A TextBox named TextBox1.

•	Two ToggleButton controls named ToggleButton1 and ToggleButton2.

Dim TextBox1

Dim ToggleButton1

Dim ToggleButton2

Sub Item_Open()

set TextBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TextBox1")

set ToggleButton1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("ToggleButton1")

set ToggleButton2 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("ToggleButton2")

TextBox1.EnterKeyBehavior = True

ToggleButton1.Caption = "EnterKeyBehavior is True"

ToggleButton1.Width = 70

ToggleButton1.Value = True

TextBox1.MultiLine = True

ToggleButton2.Caption = "MultiLine is True"

ToggleButton2.Width = 70

ToggleButton2.Value = True

TextBox1.Height = 100

TextBox1.WordWrap = True

TextBox1.Text = "Type your text here. If EnterKeyBehavior is True,"& _
" press Enter to start a new line. Otherwise, press SHIFT+ENTER."

End Sub

Sub ToggleButton1_Click()

If ToggleButton1.Value = True Then

TextBox1.EnterKeyBehavior = True

ToggleButton1.Caption = "EnterKeyBehavior is True"

Else

TextBox1.EnterKeyBehavior = False

ToggleButton1.Caption = "EnterKeyBehavior is False"

End If

End Sub

Sub ToggleButton2_Click()

If ToggleButton2.Value = True Then

TextBox1.MultiLine = True

ToggleButton2.Caption = "MultiLine TextBox"

Else

TextBox1.MultiLine = False

ToggleButton2.Caption = "Single-line TextBox"

End If

End Sub


Index Property Example

The following example uses the Index property to change the order of the pages and tabs in a MultiPage and TabStrip. The user chooses CommandButton1 to move the third page and tab to the front of the MultiPage and TabStrip. The user chooses CommandButton2 to move the selected page and tab to the back of the MultiPage and TabStrip.

To use this example, copy this sample code to the Script Editor of a form. Make sure that the form contains:

•	Two CommandButton controls named CommandButton1 and CommandButton2.

•	A MultiPage named MultiPage1.

•	A TabStrip named TabStrip1.

Dim MyPageOrTab

Dim MultiPage1

Dim TabStrip1

Sub CommandButton1_Click()

'Move third page and tab to front of control

    MultiPage1.page3.Index = 0

    TabStrip1.Tab3.Index = 0

End Sub

Sub CommandButton2_Click()

'Move selected page and tab to back of control

    Set MyPageOrObject = MultiPage1.SelectedItem

    MsgBox "MultiPage1.SelectedItem = " & MultiPage1.SelectedItem.Name

    MyPageOrObject.Index = 4

    Set MyPageOrObject = TabStrip1.SelectedItem

    MsgBox "TabStrip1.SelectedItem = " & TabStrip1.SelectedItem.Caption

    MyPageOrObject.Index = 4

End Sub

Sub Item_Open()

 Set MultiPage1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("MultiPage1")

 Set TabStrip1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TabStrip1")

 Set CommandButton1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("CommandButton1")

 Set CommandButton2 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("CommandButton2")

    MultiPage1.Width = 200

    MultiPage1.Pages.Add

    MultiPage1.Pages.Add

    MultiPage1.Pages.Add

    TabStrip1.Width = 200

    TabStrip1.Tabs.Add

    TabStrip1.Tabs.Add

    TabStrip1.Tabs.Add

    CommandButton1.Caption = "Move third page/tab to front"

    CommandButton1.Width = 120

    CommandButton2.Caption = "Move selected item to back"

    CommandButton2.Width = 120

 End Sub


Enabled, Locked Properties Example

The following example demonstrates the Enabled and Locked properties and how they complement each other. This example exposes each property independently with a CheckBox, so you observe the settings individually and combined. This example also includes a second TextBox so you can copy and paste information between the TextBox controls and verify the activities supported by the settings of these properties.

Note   You can copy the selection to the Clipboard using CTRL+C and paste using CTRL+V.

To use this example, copy this sample code to the Script Editor of a form. Make sure that the form contains:

•	A TextBox named TextBox1.

•	Two CheckBox controls named CheckBox1 and CheckBox2.

•	A second TextBox named TextBox2.

Dim TextBox1

Dim TextBox2

Dim CheckBox1

Dim CheckBox2

Sub CheckBox1_Click()

    TextBox2.Text = "TextBox2"

    TextBox1.Enabled = CheckBox1.Value

End Sub

Sub CheckBox2_Click()

    TextBox2.Text = "TextBox2"

    TextBox1.Locked = CheckBox2.Value

End Sub

Sub Item_Open()

 Set TextBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TextBox1")

 Set TextBox2 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TextBox2")

 Set CheckBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("CheckBox1")

 Set CheckBox2 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("CheckBox2")

    TextBox1.Text = "TextBox1"

    TextBox1.Enabled = True

    TextBox1.Locked = False

    CheckBox1.Caption = "Enabled"

    CheckBox1.Value = True

    CheckBox2.Caption = "Locked"

    CheckBox2.Value = False

    TextBox2.Text = "TextBox2"

End Sub


DropButtonStyle, ShowDropButtonWhen Properties Example

The following example demonstrates the different symbols that you can specify for a drop-down arrow in a ComboBox or TextBox. In this example, the user chooses a drop-down arrow style from a ComboBox. This example also uses the Locked property. To use this example, copy this sample code to the Script Editor of a form. Make sure that the form contains:

•	A ComboBox named ComboBox1.

•	A Label named Label1.

•	A TextBox named TextBox1 placed beneath Label1.

Dim TextBox1

Dim ComboBox1

Dim Label1

Sub ComboBox1_Click()

    ComboBox1.DropButtonStyle = ComboBox1.Value

    TextBox1.DropButtonStyle = ComboBox1.Value

End Sub

Sub Item_Open()

 Set TextBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TextBox1")

 Set ComboBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("ComboBox1")

 Set Label1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("Label1")

    ComboBox1.ColumnCount = 2

    ComboBox1.BoundColumn = 2

    ComboBox1.TextColumn = 1

    ComboBox1.AddItem "Blank Button"

    ComboBox1.List(0, 1) = 0

    ComboBox1.AddItem "Down Arrow"

    ComboBox1.List(1, 1) = 1

    ComboBox1.AddItem "Ellipsis"

    ComboBox1.List(2, 1) = 2

    ComboBox1.AddItem "Underscore"

    ComboBox1.List(3, 1) = 3

    ComboBox1.Value = 0

    TextBox1.Text = "TextBox1"

    TextBox1.ShowDropButtonWhen = 2 'fmShowDropButtonWhenAlways

    TextBox1.Locked = True

    Label1.Caption = "TheDropButton also applies to a TextBox."

    Label1.AutoSize = True

    Label1.WordWrap = False

End Sub


LineCount, TextLength Properties Example

The following example counts the characters and the number of lines of text in a TextBox by using the LineCount and TextLength properties, and the SetFocus method. In this example, the user can type into a TextBox, and can retrieve current values of the LineCount and TextLength properties.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains the following controls:

•	A TextBox named TextBox1.

•	A CommandButton named CommandButton1.

•	Two Label controls named Label1 and Label2.

'Type SHIFT+ENTER to start a new line in the text box.

Dim CommandButton1

Dim TextBox1

Dim Label1

Dim Label2

Sub CommandButton1_Click()

    'Must first give TextBox1 the focus to get line count

    TextBox1.SetFocus

    Label1.Caption = "LineCount = " & TextBox1.LineCount

    Label2.Caption = "TextLength = " & TextBox1.TextLength

End Sub

Sub Item_Open()

 Set TextBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TextBox1")

 Set Label1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("Label1")

 Set Label2 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("Label2")

 Set CommandButton1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("CommandButton1")

    CommandButton1.WordWrap = True

    CommandButton1.AutoSize = True

    CommandButton1.Caption = "Get Counts"

    Label1.Caption = "LineCount = "

    Label2.Caption = "TextLength = "

    TextBox1.MultiLine = True

    TextBox1.WordWrap = True

    TextBox1.Text = "Enter your text here."

End Sub


Count Property Example

The following example displays the Count property of the Controls collection for the form, and the Count property identifying the number of pages and tabs of each MultiPage and TabStrip.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. The form can contain any number of controls, with the following restrictions:

•	Names of MultiPage controls must start with “MultiPage”.

•	Names of TabStrip controls must start with “TabStrip”.

Note   You can add pages to a MultiPage or add tabs to a TabStrip while in design mode.  Double-click on the control, then right click in the tab area of the control and choose New Page from the shortcut menu.

Sub Item_Open

    Dim Controls

    Dim MyControl

    Set Controls = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls

    MsgBox "Controls.Count = " & Controls.Count

    For i = 0 to Controls.Count -1

Set MyControl = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls.Item(i)

        If (MyControl.Name = "MultiPage1") Then

            MsgBox MyControl.Name & ".Pages.Count = " & MyControl.Pages.Count

        ElseIf (MyControl.Name = "TabStrip1") Then

            MsgBox MyControl.Name & ".Tabs.Count = " & MyControl.Tabs.Count

        End If

    Next

End Sub


Alignment Property Example

The following example demonstrates the Alignment property used with several OptionButton controls. In this example, the user can change the alignment by clicking a ToggleButton.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains the following controls:

•	Two OptionButton controls named OptionButton1 and OptionButton2.

•	A ToggleButton named ToggleButton1.

Dim OptionButton1

Dim OptionButton2

Dim ToggleButton1

Sub Item_Open()

 Set OptionButton1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("OptionButton1")

 Set OptionButton2 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("OptionButton2")

 Set ToggleButton1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("ToggleButton1")

    OptionButton1.Alignment = 0 'fmAlignmentLeft

    OptionButton2.Alignment = 0 'fmAlignmentLeft

    OptionButton1.Caption = "Alignment with AutoSize"

    OptionButton2.Caption = "Choice 2"

    OptionButton1.AutoSize = True

    OptionButton2.AutoSize = True

    ToggleButton1.Caption = "Left Align"

    ToggleButton1.WordWrap = True

    ToggleButton1.Value = True

End Sub

Sub ToggleButton1_Click()

    If ToggleButton1.Value = True Then

        ToggleButton1.Caption = "Left Align"

        OptionButton1.Alignment = 0 'fmAlignmentLeft

        OptionButton2.Alignment = 0 'fmAlignmentLeft

    Else

        ToggleButton1.Caption = "Right Align"

        OptionButton1.Alignment = 1 'fmAlignmentRight

        OptionButton2.Alignment = 1 'fmAlignmentRight

    End If

End Sub


DropDown Method Example

The following example uses the DropDown method to display the list in a ComboBox. The user can display the list of a ComboBox by clicking the CommandButton.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A ComboBox named ComboBox1.

•	A CommandButton named CommandButton1.

Dim ComboBox1

Sub CommandButton1_Click()

    ComboBox1.DropDown

End Sub

Sub Item_Open()

 Set ComboBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("ComboBox1")

    ComboBox1.AddItem "Turkey"

    ComboBox1.AddItem "Chicken"

    ComboBox1.AddItem "Duck"

    ComboBox1.AddItem "Goose"

    ComboBox1.AddItem "Grouse"

End Sub


Cut and Paste From a TextBox Example

The following example uses the Cut and Paste methods to cut text from one TextBox and paste it into another TextBox.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	Two TextBox controls named TextBox1 and TextBox2.

•	A CommandButton named CommandButton1.

Dim TextBox1

Dim TextBox2

Dim CommandButton1

Sub Item_Open()

Set TextBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TextBox1")

Set TextBox2 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TextBox2")

Set CommandButton1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("CommandButton1")

    TextBox1.Text = "From TextBox1!"

    TextBox2.Text = "Hello "

    CommandButton1.Caption = "Cut and Paste"

    CommandButton1.AutoSize = True

End Sub

Sub CommandButton1_Click()

    TextBox2.SelStart = 0

    TextBox2.SelLength = TextBox2.TextLength

    TextBox2.Cut

    TextBox1.SetFocus

    TextBox1.SelStart = 0

    TextBox1.Paste

    TextBox2.SelStart = 0

End Sub


Cut and Paste From a Page Example

The following example uses the Add, Cut, and Paste methods to cut and paste a control from a Page of a MultiPage. The control involved in the cut and paste operations is dynamically added to the form.

This example assumes the user will add, then cut, then paste the new control.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	Three CommandButton controls named CommandButton1 through CommandButton3.

•	A MultiPage named MultiPage1.

Dim CommandButton1

Dim CommandButton2

Dim CommandButton3

Dim MultiPage1

Dim MyTextBox

Sub CommandButton1_Click()

    Set MyTextBox = MultiPage1.Pages(MultiPage1.Value).Controls.Add("Forms.TextBox.1", "MyTextBox", 1)

    CommandButton2.Enabled = True

    CommandButton1.Enabled = False

End Sub

Sub CommandButton2_Click()

    MultiPage1.Pages(MultiPage1.Value).Controls.Cut

    CommandButton3.Enabled = True

    CommandButton2.Enabled = False

End Sub

Sub CommandButton3_Click()

    Dim MyPage

    Set MyPage = MultiPage1.Pages.Item(MultiPage1.Value)

    MyPage.Paste

    CommandButton3.Enabled = False

End Sub

Sub Item_Open()

Set CommandButton1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("CommandButton1")

Set CommandButton2 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("CommandButton2")

Set CommandButton3 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("CommandButton3")

Set MultiPage1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("MultiPage1")

    CommandButton1.Caption = "Add"

    CommandButton2.Caption = "Cut"

    CommandButton3.Caption = "Paste"

    CommandButton1.Enabled = True

    CommandButton2.Enabled = False

    CommandButton3.Enabled = False

End Sub


Name Property Example

The following example displays the Name property of each control on a form. This example uses the Controls collection to cycle through all the controls placed directly on the User form.

To use this example, copy this sample code to the Script Editor of a form. Make sure that the form contains a CommandButton named CommandButton1 and several other controls.

Sub CommandButton1_Click()

    Set Controls = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls

    For i = 0 to Controls.Count - 1

        MsgBox "MyControl.Name = " & Controls.Item(i).Name

    Next

End Sub


Accessing a Tab Example

The following example accesses an individual tab of a TabStrip in several ways:

•	Using the Tabs collection with a numeric index.

•	Using the Tabs collection with a string index.

•	Using the Tabs collection with the Item method.

•	Using the name of the individual Tab.

•	Using the SelectedItem property.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains a TabStrip named TabStrip1.

Sub Item_Open()

    Dim TabStrip1

    Dim TabName

     Set TabStrip1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TabStrip1")

    For i = 0 To TabStrip1.Count - 1

        'Using index (numeric or string)

        MsgBox "TabStrip1.Tabs(i).Caption = " & TabStrip1.Tabs(i).Caption

        MsgBox "TabStrip1.Tabs.Item(i).Caption = " & TabStrip1.Tabs.Item(i).Caption

        TabName = TabStrip1.Tabs(i).Name

        MsgBox "TabName = " & TabName

        MsgBox "TabStrip1.Tabs(TabName).Caption = " & TabStrip1.Tabs(TabName).Caption

        MsgBox "TabStrip1.Tabs.Item(TabName).Caption = " & TabStrip1.Tabs.Item(TabName).Caption

        'Use Tab object without referring to Tabs collection

        If i = 0 Then

            MsgBox "TabStrip1.Tab1. Caption = " & TabStrip1.Tab1.Caption

        ElseIf i = 1 Then

            MsgBox "TabStrip1.Tab2. Caption = " & TabStrip1.Tab2.Caption

        End If

        'Use SelectedItem Property

        TabStrip1.Value = i

        MsgBox " TabStrip1.SelectedItem.Caption = " & TabStrip1.SelectedItem.Caption

    Next

End Sub


TextColumn Property Example

The following example uses the TextColumn property to identify the column of data in a ListBox that supplies data for its Text property. This example sets the third column of the ListBox as the text column. As you select an entry from the ListBox, the value from the TextColumn will be displayed in the TextBox.

This example also demonstrates how to load a multicolumn ListBox using the AddItem method and the List property.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A ListBox named ListBox1.

•	A TextBox named TextBox1.

Dim ListBox1

Dim TextBox1

Sub Item_Open()

Set ListBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("ListBox1")

Set TextBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TextBox1")

ListBox1.ColumnCount = 3

ListBox1.AddItem "Row 1, Col 1"

ListBox1.List(0, 1) = "Row 1, Col 2"

ListBox1.List(0, 2) = "Row 1, Col 3"

ListBox1.AddItem "Row 2, Col 1"

ListBox1.List(1, 1) = "Row 2, Col 2"

ListBox1.List(1, 2) = "Row 2, Col 3"

ListBox1.AddItem "Row 3, Col 1"

ListBox1.List(2, 1) = "Row 3, Col 2"

ListBox1.List(2, 2) = "Row 3, Col 3"

ListBox1.TextColumn = 3

End Sub

Sub ListBox1_Click()

TextBox1.Text = ListBox1.Text

End Sub


GroupName Property Example

The following example uses the GroupName property to create two groups of OptionButton controls on the same form.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains five OptionButton controls named OptionButton1 through OptionButton5.

Sub Item_Open()

 set OptionButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton1")

 set OptionButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton2")

 set OptionButton3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton3")

 set OptionButton4 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton4")

 set OptionButton5 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton5")

 OptionButton1.Caption = "Widgets"

 OptionButton2.Caption = "Widgets"

 OptionButton3.Caption = "Widgets"

    OptionButton1.GroupName = "Widgets"

    OptionButton2.GroupName = "Widgets"

    OptionButton3.GroupName = "Widgets"

 OptionButton4.Caption = "Gadgets-Group2"

 OptionButton5.Caption = "Gadgets-Group2"

    OptionButton4.GroupName = "Gadgets-Group2"

    OptionButton5.GroupName = "Gadgets-Group2"

End Sub


DragBehavior, EnterFieldBehavior Properties Example

The following example uses the DragBehavior and EnterFieldBehavior properties to demonstrate the different effects that you can provide when entering a control and when dragging information from one control to another.

The sample uses two TextBox controls. You can set DragBehavior and EnterFieldBehavior for each control and see the effects of dragging from one control to another.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A TextBox named TextBox1.

•	Two ToggleButton controls named ToggleButton1 and ToggleButton2. These controls are associated with TextBox1.

•	A TextBox named TextBox2.

•	Two ToggleButton controls named ToggleButton3 and ToggleButton4. These controls are associated with TextBox2.

Dim TextBox1, TextBox2

Dim ToggleButton1, ToggleButton2, ToggleButton3, ToggleButton4

Sub Item_Open()

 set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1")

 set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox2")

 set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton1")

 set ToggleButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton2")

 set ToggleButton3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton3")

 set ToggleButton4 = Item.GetInspector.ModifiedFormPages("P.2").Controls("ToggleButton4")

    TextBox1.Text = "Once upon a time in a land ...,"

    ToggleButton1.Value = True

    ToggleButton1.Caption = "Drag Enabled"

    ToggleButton1.WordWrap = True

    TextBox1.DragBehavior = 1 'fmDragBehaviorEnabled

    ToggleButton2.Value = True

    ToggleButton2.Caption = "Recall Selection"

    ToggleButton2.WordWrap = True

    TextBox1.EnterFieldBehavior = 1 'fmEnterFieldBehaviorRecallSelection

    TextBox2.Text = "XXX, YYYY"

    ToggleButton3.Value = False

    ToggleButton3.Caption = "Drag Disabled"

    ToggleButton3.WordWrap = True

    TextBox2.DragBehavior = 0 'fmDragBehaviorDisabled

    ToggleButton4.Value = False

    ToggleButton4.Caption = "Select All"

    ToggleButton4.WordWrap = True

    TextBox2.EnterFieldBehavior = 0 'fmEnterFieldBehaviorSelectAll

End Sub

Sub ToggleButton1_Click()

    If ToggleButton1.Value = True Then

       ToggleButton1.Caption = "Drag Enabled"

       TextBox1.DragBehavior = 1 'fmDragBehaviorEnabled

    Else

       ToggleButton1.Caption = "Drag Disabled"

       TextBox1.DragBehavior = 0 'fmDragBehaviorDisabled

    End If

End Sub

Sub ToggleButton2_Click()

    If ToggleButton2.Value = True Then

        ToggleButton2.Caption = "Recall Selection"

        TextBox1.EnterFieldBehavior = 1 'fmEnterFieldBehaviorRecallSelection

    Else

        ToggleButton2.Caption = "Select All"

        TextBox1.EnterFieldBehavior = 0 'fmEnterFieldBehaviorSelectAll

    End If

End Sub

Sub ToggleButton3_Click()

    If ToggleButton3.Value = True Then

       ToggleButton3.Caption = "Drag Enabled"

       TextBox2.DragBehavior = 1 'fmDragBehaviorEnabled

    Else

       ToggleButton3.Caption = "Drag Disabled"

       TextBox2.DragBehavior = 0 'fmDragBehaviorDisabled

    End If

End Sub

Sub ToggleButton4_Click()

    If ToggleButton4.Value = True Then

        ToggleButton4.Caption = "Recall Selection"

        TextBox2.EnterFieldBehavior = 1 'fmEnterFieldBehaviorRecallSelection

    Else

       ToggleButton4.Caption = "Select All"

       TextBox2.EnterFieldBehavior = 0 'fmEnterFieldBehaviorSelectAll

    End If

End Sub


CanUndo, CanRedo Properties, UndoAction, RedoAction Methods Example
UndoAction, RedoAction Methods Example

The following example demonstrates how to undo or redo text editing within a text box or within the text area of a ComboBox. This sample checks whether an undo or redo operation can occur and then performs the appropriate action. The sample uses the CanUndo and CanRedo properties, and the UndoAction and RedoAction methods.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A TextBox named TextBox1.

•	A ComboBox named ComboBox1.

•	Two CommandButton controls named CommandButton1 and CommandButton2.

Dim UserForm1

Sub CommandButton1_Click()

    If UserForm1.CanUndo = True Then

        UserForm1.UndoAction

        MsgBox "Undid IT"

    Else

        MsgBox "No undo performed."

    End If

End Sub

Sub CommandButton2_Click()

    If UserForm1.CanRedo = True Then

        UserForm1.RedoAction

        MsgBox "Redid IT"

    Else

        MsgBox "No redo performed."

    End If

End Sub

Sub Item_Open()

 Set UserForm1 = Item.GetInspector.ModifiedFormPages("P.2")

 Set TextBox1 = UserForm1.Controls("TextBox1")

 Set ComboBox1 = UserForm1.Controls("ComboBox1")

 Set CommandButton1 = UserForm1.Controls("CommandButton1")

 Set CommandButton2 = UserForm1.Controls("CommandButton2")

    TextBox1.Text = "Type your text here."

    ComboBox1.ColumnCount = 3

    ComboBox1.AddItem "Choice 1, column 1"

    ComboBox1.List(0, 1) = "Choice 1, column 2"

    ComboBox1.List(0, 2) = "Choice 1, column 3"

    CommandButton1.Caption = "Undo"

    CommandButton2.Caption = "Redo"

End Sub


BoundColumn Property Example

The following example demonstrates how the BoundColumn property influences the value of a ListBox. The user can choose to set the value of the ListBox to the index value of the specified row, or to a specified column of data in the ListBox.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A ListBox named ListBox1.

•	A Label named Label1.

•	Three OptionButton controls named OptionButton1, OptionButton2, and OptionButton3.

Dim Listbox1

Dim OptionButton1

Dim OptionButton2

Dim OptionButton3

Dim Label1

Sub Item_Open

  Set Listbox1 = Item.GetInspector.ModifiedFormPages("P.2").Listbox1

  Set OptionButton1 = Item.GetInspector.ModifiedFormPages("P.2").OptionButton1

  Set OptionButton2 = Item.GetInspector.ModifiedFormPages("P.2").OptionButton2

  Set OptionButton3 = Item.GetInspector.ModifiedFormPages("P.2").OptionButton3

  Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Label1

  Listbox1.ColumnCount = 2

  Listbox1.AddItem "Item 1, Column 1"

  Listbox1.List(0, 1) = "Item 1, Column 2"

  Listbox1.AddItem "Item 2, Column 1"

  Listbox1.List(1, 1) = "Item 2, Column 2"

  Listbox1.Value  = "Item 1, Column 1"

  OptionButton1.Caption = "List Index"

  OptionButton2.Caption = "Column 1"

  OptionButton3.Caption = "Column 2"

  OptionButton2.Value = True

End Sub

Sub OptionButton1_Click

  Listbox1.BoundColumn = 0

  Label1.Caption = Listbox1.Value

End Sub

Sub OptionButton2_Click

  Listbox1.BoundColumn = 1

  Label1.Caption = Listbox1.Value

End Sub

Sub OptionButton3_Click

  Listbox1.BoundColumn = 2

  Label1.Caption = Listbox1.Value

End Sub

Sub Listbox1_Click

  Label1.Caption = Listbox1.Value

End Sub


List Property Example

The following example swaps columns of a multicolumn ListBox. The sample uses the List property in two ways:

1.	To access and exchange individual values in the ListBox. In this usage, List has subscripts to designate the row and column of a specified value.

2.	To initially load the ListBox with values from an array. In this usage, List has no subscripts.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains a ListBox named ListBox1 and a CommandButton named CommandButton1.

Dim Listbox1

Dim MyArray(6, 3)

Sub Item_Open

  Dim i

  Set Listbox1 = Item.GetInspector.ModifiedFormPages("P.2").Listbox1

  Listbox1.ColumnCount = 3

  For i = 0 to 5

    MyArray(i, 0) = i

    MyArray(i, 1) = Rnd

    MyArray(i, 2) = Rnd

  Next

  Listbox1.List() = MyArray

End Sub

Sub CommandButton1_Click

  Dim i

  Dim Temp

  For i = 0 to 5

    Temp = Listbox1.List(i, 0)

    Listbox1.List(i, 0) = Listbox1.List(i, 2)

    Listbox1.List(i, 2) = Temp

  Next

End Sub


ClientHeight, ClientLeft, ClientTop, ClientWidth Properties Example

The following example sets the dimensions of an Image to the size of a TabStrip's client area when the user clicks a CommandButton. This code sample uses the following properties: Height, Left, Top, Width, ClientHeight, ClientLeft, ClientTop, and ClientWidth.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A CommandButton named CommandButton1.

•	A TabStrip named TabStrip1.

•	An Image named Image1.

Dim CommandButton1

Dim Image1

Dim TabStrip1

Sub Item_Open

  Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton1

  Set Image1 = Item.GetInspector.ModifiedFormPages("P.2").Image1

  Set TabStrip1 = Item.GetInspector.ModifiedFormPages("P.2").TabStrip1

  CommandButton1.Caption = "Size Image to Tab Area"

  CommandButton1.WordWrap = True

  CommandButton1.AutoSize = True

End Sub

Sub CommandButton1_Click

  Image1.ZOrder (fmFront) ‘Place Image in front of TabStrip

‘Client Left and ClientTop are measured from the edge of the TabStrip,

‘not from the edges of the form containing the TabStrip.

  Image1.Left = TabStrip1.Left + TabStrip1.ClientTop

  Image1.Top = TabStrip1.Top + TabStrip1.ClientTop

  Image1.Width = TabStrip1.ClientWidth

  Image1.Height = TabStrip1.ClientHeight

End Sub


MultiLine, WordWrap, ScrollBars Properties Example

The following example demonstrates the MultiLine, WordWrap, and ScrollBars properties on a TextBox.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A TextBox named TextBox1.

•	Four ToggleButton controls named ToggleButton1 through ToggleButton4.

To see the entire text placed in the TextBox, set MultiLine and WordWrap to True by clicking the ToggleButton controls.

When MultiLine is True, you can enter new lines of text by pressing SHIFT+ENTER.

ScrollBars appears when you manually change the content of the TextBox.

Dim ToggleButton1

Dim ToggleButton2

Dim ToggleButton3

Dim ToggleButton4

Dim TextBox1

Sub Item_Open

'Initialize TextBox properties and toggle buttons

  Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").ToggleButton1

  Set ToggleButton2 = Item.GetInspector.ModifiedFormPages("P.2").ToggleButton2

  Set ToggleButton3 = Item.GetInspector.ModifiedFormPages("P.2").ToggleButton3

  Set ToggleButton4 = Item.GetInspector.ModifiedFormPages("P.2").ToggleButton4

  Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").TextBox1

  TextBox1.Text = "Type your text here.  Enter SHIFT+ENTER to move to a new line."

  TextBox1.AutoSize = False

  ToggleButton1.Caption = "AutoSize Off"

  ToggleButton1.Value = False

  ToggleButton1.AutoSize = True

  TextBox1.WordWrap = False

  ToggleButton2.Caption = "WordWrap Off"

  ToggleButton2.Value = False

  ToggleButton2.AutoSize = True

  TextBox1.ScrollBars = 0

  ToggleButton3.Caption = "ScrollBars Off"

  ToggleButton3.Value = False

  ToggleButton3.AutoSize = True

  TextBox1.MultiLine = False

  ToggleButton4.Caption = "Single Line"

  ToggleButton4.Value = False

  ToggleButton4.AutoSize = True

End Sub

Sub ToggleButton1_Click

'Set AutoSize property and associated ToggleButton

  If ToggleButton1.Value = True Then

    TextBox1.AutoSize = True

    ToggleButton1.Caption = "AutoSize On"

  Else

    TextBox1.AutoSize = False

    ToggleButton1.Caption = "AutoSize Off"

  End if

End Sub

Sub ToggleButton2_Click

'Set WordWrap property and associated  ToggleButton

  If ToggleButton2.Value = True Then

    TextBox1.WordWrap = True

    ToggleButton2.Caption = "WordWrap On"

  Else

    TextBox1.WordWrap = False

    ToggleButton2.Caption = "WordWrap Off"

  End if

End Sub

Sub ToggleButton3_Click

'Set ScrollBars property and associated ToggleButton

  If ToggleButton3.Value = True Then

    TextBox1.ScrollBars = 3

    ToggleButton3.Caption = "ScrollBars On"

  Else

    TextBox1.ScrollBars = 0

    ToggleButton3.Caption = "ScrollBars Off"

  End if

End Sub

Sub ToggleButton4_Click

'Set MultiLine property and associated ToggleButton

  If ToggleButton4.Value = True Then

    TextBox1.MultiLine = True

    ToggleButton4.Caption = "Multiple Lines"

  Else

    TextBox1.MultiLine = False

    ToggleButton4.Caption = "Single Line"

  End if

 End Sub


Accessing a Page Example

The following example accesses an individual page of a MultiPage in several ways:

•	Using the Pages collection with a numeric index.

•	Using the Pages collection with a string index.

•	Using the Pages collection with the Item method.

•	Using the name of the individual page in the MultiPage.

•	Using the SelectedItem property.

To use this example, copy this sample code to the Script Editor of a form. Make sure that the form contains a MultiPage named MultiPage1 and a CommandButton named CommandButton1.

Sub CommandButton1_Click

  Dim PageName

  Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").MultiPage1

  For i = 0 To MultiPage1.Count - 1

    'Use index (numeric or string)

    MsgBox "MultiPage1.Pages(i).Caption = " & MultiPage1.Pages(i).Caption

    MsgBox "MultiPage1.Pages.Item(i).Caption = " & MultiPage1.Pages.Item(i).Caption

    PageName = MultiPage1.Pages(i).Name

    MsgBox "PageName = " & PageName

    MsgBox "MultiPage1.Pages(PageName).Caption = " & MultiPage1.Pages(PageName).Caption

    MsgBox "MultiPage1.Pages.Item(PageName).Caption = " & MultiPage1.Pages.Item(PageName).Caption

    ‘Use Page object without referring to Pages collection

    If i = 0 Then

      MsgBox "MultiPage1.Page1.Caption = " & MultiPage1.Page1.Caption

    ElseIf i = 1 Then

      MsgBox "MultiPage1.Page2.Caption = " & MultiPage1.Page2.Caption

    End If

    ‘Use SelectedItem Property

    MultiPage1.Value = i

    MsgBox "MultiPage1.SelectedItem.Caption = " & MultiPage1.SelectedItem.Caption

  Next

End Sub


Adding a Control Example

The following example uses the Add method to add a control to a form at run time and uses the AddControl event as confirmation that the control was added.

To use this example, copy this sample code to the Script Editor of a form. Make sure that the form contains:

•	A CommandButton named CommandButton1.

Dim Mycmd

Sub CommandButton1_Click()

   Set Mycmd = Item.GetInspector.ModifiedFormPages("P.2").Controls.Add("Forms.CommandButton.1") ', CommandButton2, Visible)

  Mycmd.Left = 18

  Mycmd.Top = 150

  Mycmd.Width = 175

  Mycmd.Height = 20

  Mycmd.Caption = "This is fun." & Mycmd.Name

End Sub


Adding a Control to a MultiPage Example

The following example uses the Add, Clear, and Remove methods to add and remove a control to a Page of a MultiPage at run time.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A MultiPage named MultiPage1.

•	Three CommandButton controls named CommandButton1 through CommandButton3.

Dim MyTextBox

Dim MultiPage1

Sub Item_Open()

  Set MyPage = Item.GetInspector.ModifiedFormPages("P.2")

  Set MultiPage1 = MyPage.MultiPage1

  MyPage.CommandButton1.Caption = "Add control"

  MyPage.CommandButton2.Caption = "Clear controls"

  MyPage.CommandButton3.Caption = "Remove control"

End Sub

Sub CommandButton1_Click()

  Set MyTextBox = MultiPage1.Pages(0).Controls.Add("Forms.TextBox.1", "MyTextBox", 1)

End Sub

Sub CommandButton2_Click()

  MultiPage1.Pages(0).Controls.Clear

End Sub

Sub CommandButton3_Click()

  If MultiPage1.Pages(0).Controls.Count > 0  Then

    MultiPage1.Pages(0).Controls.Remove "MyTextBox"

  End If

End Sub


ListBox Control Example

The following example adds and deletes the contents of a ListBox using the AddItem, RemoveItem, and SetFocus methods, and the ListIndex and ListCount properties.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A ListBox named ListBox1.

•	Two CommandButton controls named CommandButton1 and CommandButton2.

Dim EntryCount

Dim Listbox1

Sub Item_Open()

  Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").ListBox1

  Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton1

  Set CommandButton2 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton2

  EntryCount = 0

  CommandButton1.Caption = "Add Item"

  CommandButton2.Caption = "Remove Item"

End Sub

Sub CommandButton1_Click()

  EntryCount = EntryCount + 1

  ListBox1.AddItem (EntryCount & " - Selection")

End Sub

Sub CommandButton2_Click()

  ListBox1.SetFocus

  'Ensure ListBox contains list items

  If ListBox1.ListCount >= 1 Then

      'If no selection, choose last list item.

      If ListBox1.ListIndex = -1 Then

          ListBox1.ListIndex = ListBox1.ListCount - 1

      End If

      ListBox1.RemoveItem (ListBox1.ListIndex)

  End If

End Sub


ZOrder Method Example

The following example sets the z-order of a TextBox, so the user can display the entire TextBox (by bringing it to the front of the z-order) or can place the TextBox behind other controls (by sending it to the back of the z-order).

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	Three TextBox controls named TextBox1 through TextBox3.

•	A ToggleButton named ToggleButton1.

Dim ToggleButton1

Dim TextBox1

Dim TextBox2

Dim TextBox3

Sub Item_Open()

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").TextBox1

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").TextBox2

Set TextBox3 = Item.GetInspector.ModifiedFormPages("P.2").TextBox3

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").ToggleButton1

'Set up text boxes to show z-order in the form

TextBox1.Text = "TextBox 1"

TextBox2.Text = "TextBox 2"

TextBox3.Text = "TextBox 3"

TextBox1.Height = 40

TextBox2.Height = 40

TextBox3.Height = 40

TextBox1.Width = 60

TextBox2.Width = 60

TextBox3.Width = 60

TextBox1.Left = 10

TextBox1.Top = 10

TextBox2.Left = 25      'Overlap TextBox2 on TextBox1

TextBox2.Top = 25

TextBox3.Left = 40      'Overlap TextBox3 on TextBox2, TextBox1

TextBox3.Top = 40

ToggleButton1.Value = False

ToggleButton1.Caption = "Bring TextBox2 to Front"

ToggleButton1.Left = 10

ToggleButton1.Top = 90

ToggleButton1.Width = 50

ToggleButton1.Height = 50

End Sub

Sub ToggleButton1_Click()

If ToggleButton1.Value = True Then

  TextBox2.ZOrder (fmTop)          'Place TextBox2 on Top of z-order

  'Update ToggleButton caption to identify next state

  ToggleButton1.Caption = "Send TextBox2 to back"

Else

TextBox2.ZOrder (1)              'Place TextBox2 on Bottom of z-order

'Update ToggleButton caption to identify next state

ToggleButton1.Caption = "Bring TextBox2 to front"

End If

End Sub


Accelerator, Caption Properties Example

This example changes the Accelerator and Caption properties of a CommandButton each time the user clicks the button by using the mouse or the accelerator key. The Click event contains the code to change the Accelerator and Caption properties.

To try this example, paste the code into the Script Editor of a form containing a CommandButton named CommandButton1. To run the code you need to open the form so the Open event will activate.

Dim CommandButton1

Sub Item_Open()

  Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton1

  CommandButton1.Accelerator  = "C"         'Set Accelerator key to ALT + C

End Sub

Sub CommandButton1_Click ()

  If CommandButton1.Caption = "OK" Then     'Check caption, then change it.

    CommandButton1.Caption = "Clicked"

    CommandButton1.Accelerator  = "C"         'Set Accelerator key to ALT + C

  Else

    CommandButton1.Caption = "OK"

    CommandButton1.Accelerator  = "O"         'Set Accelerator key to ALT + O

  End If

End Sub


AutoSize Property Example

The following example demonstrates the effects of the AutoSize property with a single-line TextBox and a multiline TextBox. The user can enter text into either of the TextBox controls and turn AutoSize on or off independently of the contents of the TextBox. This code sample also uses the Text property.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	Two TextBox controls named TextBox1 and TextBox2.

•	A ToggleButton named ToggleButton1.

Dim ToggleButton1

Dim TextBox1

Dim TextBox2

Sub Item_Open()

  Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").ToggleButton1

  Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").TextBox1

  Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").TextBox2

  TextBox1.Text = "Single-line TextBox. Type your text here."

  TextBox2.MultiLine = True

  TextBox2.Text = "Multi-line TextBox. Type your text here. Use SHIFT+ENTER to start a new line."

  ToggleButton1.Value = True

  ToggleButton1.Caption = "AutoSize On"

  TextBox1.AutoSize = True

  TextBox2.AutoSize = True

End Sub

Sub ToggleButton1_Click()

  If ToggleButton1.Value = True Then

    ToggleButton1.Caption = "AutoSize On"

    TextBox1.AutoSize = True

    TextBox2.AutoSize = True

  Else

    ToggleButton1.Caption = "AutoSize Off"

    TextBox1.AutoSize = False

    TextBox2.AutoSize = False

  End If

End Sub


Bold, Italic, Size, StrikeThrough, Underline, Weight Properties Example

The following example demonstrates a Font object and the Bold, Italic, Size, StrikeThrough, Underline, and Weight properties related to fonts. You can manipulate font properties of an object directly or by using an alias, as this example also shows.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A Label named Label1.

•	Four ToggleButton controls named ToggleButton1 through ToggleButton4.

•	A second Label and a TextBox named Label2 and TextBox1.

Dim MyFont

Dim ToggleButton1

Dim ToggleButton2

Dim ToggleButton3

Dim ToggleButton4

Dim Label1

Dim Label2

Dim TextBox1

Sub Item_Open()

  Set MyPage = Item.GetInspector.ModifiedFormPages("P.2")

  Set ToggleButton1 = MyPage.ToggleButton1

  Set ToggleButton2 = MyPage.ToggleButton2

  Set ToggleButton3 = MyPage.ToggleButton3

  Set ToggleButton4 = MyPage.ToggleButton4

  Set Label1 = MyPage.Label1

  Set Label2 = MyPage.Label2

  Set TextBox1 = MyPage.TextBox1

  Set MyFont = Label1.Font

  ToggleButton1.Value = True

  ToggleButton1.Caption = "Bold On"

  Label1.AutoSize = True	'Set size of Label1

  Label1.AutoSize = False

  ToggleButton2.Value = False

  ToggleButton2.Caption = "Italic Off"

  ToggleButton3.Value = False

  ToggleButton3.Caption = "StrikeThrough Off"

  ToggleButton4.Value = False

  ToggleButton4.Caption = "Underline Off"

  Label2.Caption = "Font Weight"

  TextBox1.Text = Label1.Font.Weight

  TextBox1.Enabled = False

End Sub

Sub ToggleButton1_Click()

  If ToggleButton1.Value = True Then

    MyFont.Bold = True            'Using MyFont alias to control font

    ToggleButton1.Caption = "Bold On"

    MyFont.Size = 22              'Increase the font size

  Else

    MyFont.Bold = False

    ToggleButton1.Caption = "Bold Off"

    MyFont.Size = 8               'Return font size to initial size

  End If

  TextBox1.Text = CStr(MyFont.Weight)  'Bold and Weight are related

End Sub

Sub ToggleButton2_Click()

  If ToggleButton2.Value = True Then

    Label1.Font.Italic = True            'Using Label1.Font directly

    ToggleButton2.Caption = "Italic On"

  Else

    Label1.Font.Italic = False

    ToggleButton2.Caption = "Italic Off"

  End If

End Sub

Sub ToggleButton3_Click()

  If ToggleButton3.Value = True Then

    Label1.Font.Strikethrough = True            'Using Label1.Font directly

    ToggleButton3.Caption = "StrikeThrough On"

  Else

    Label1.Font.Strikethrough = False

    ToggleButton3.Caption = "StrikeThrough Off"

  End If

End Sub

Sub ToggleButton4_Click()

  If ToggleButton4.Value = True Then

    MyFont.Underline = True            'Using MyFont alias for Label1.Font

    ToggleButton4.Caption = "Underline On"

  Else

    Label1.Font.Underline = False

    ToggleButton4.Caption = "Underline Off"

  End If

End Sub


Border, Color Enhancements Example

The following example demonstrates the BorderStyle and SpecialEffect properties, showing each border available through these properties. The example also demonstrates how to control color settings by using the BackColor, BackStyle, BorderColor, and ForeColor properties.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	Six TextBox controls named TextBox1 through TextBox6.

•	Two ToggleButton controls named ToggleButton1 and ToggleButton2.

Dim TextBox1

Dim TextBox2

Dim TextBox3

Dim TextBox4

Dim TextBox5

Dim TextBox6

Dim ToggleButton1

Dim ToggleButton2

Sub Item_Open()

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").TextBox1

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").TextBox2

Set TextBox3 = Item.GetInspector.ModifiedFormPages("P.2").TextBox3

Set TextBox4 = Item.GetInspector.ModifiedFormPages("P.2").TextBox4

Set TextBox5 = Item.GetInspector.ModifiedFormPages("P.2").TextBox5

Set TextBox6 = Item.GetInspector.ModifiedFormPages("P.2").TextBox6

Set ToggleButton1 = Item.GetInspector.ModifiedFormPages("P.2").ToggleButton1

Set ToggleButton2 = Item.GetInspector.ModifiedFormPages("P.2").ToggleButton2

'Initialize each TextBox with a border style or special effect,

'and foreground and background colors

'TextBox1 initially uses a borderstyle

TextBox1.Text = "BorderStyle-Single"

TextBox1.BorderStyle = 1

TextBox1.BorderColor = RGB(255, 128, 128)   'Color - Salmon

TextBox1.ForeColor = RGB(255, 255, 0)       'Color - Yellow

TextBox1.BackColor = RGB(0, 128, 64)        'Color - Green #2

'TextBoxes 2 through 6 initially use special effects

TextBox2.Text = "Flat"

TextBox2.SpecialEffect = 0

TextBox2.ForeColor = RGB(64, 0, 0)          'Color - Brown

TextBox2.BackColor = RGB(0, 0, 255)         'Color - Blue

'Ensure the background style for TextBox2 is initially opaque.

TextBox2.BackStyle = 1

TextBox3.Text = "Etched"

TextBox3.SpecialEffect = 3

TextBox3.ForeColor = RGB(128, 0, 255)       'Color - Purple

TextBox3.BackColor = RGB(0, 255, 255)       'Color - Cyan

'Define BorderColor for later use (when borderstyle=fmBorderStyleSingle)

TextBox3.BorderColor = RGB(0, 0, 0)         'Color - Black

TextBox4.Text = "Bump"

TextBox4.SpecialEffect = 6

TextBox4.ForeColor = RGB(255, 0, 255)       'Color - Magenta

TextBox4.BackColor = RGB(0, 0, 100)         'Color - Navy blue

TextBox5.Text = "Raised"

TextBox5.SpecialEffect = 1

TextBox5.ForeColor = RGB(255, 0, 0)         'Color - Red

TextBox5.BackColor = RGB(128, 128, 128)     'Color - Gray

TextBox6.Text = "Sunken"

TextBox6.SpecialEffect = 2

TextBox6.ForeColor = RGB(0, 64, 0)          'Color - Olive

TextBox6.BackColor = RGB(0, 255, 0)         'Color - Green #1

ToggleButton1.Caption = "Swap styles"

ToggleButton2.Caption = "Transparent/Opaque background"

End Sub

Sub ToggleButton1_Click()

'Swap borders between TextBox1 and TextBox3

If ToggleButton1.Value = True Then

'Change TextBox1 from BorderStyle to Etched

TextBox1.Text = "Etched"

TextBox1.SpecialEffect = 3

'Change TextBox3 from Etched to BorderStyle

TextBox3.Text = "BorderStyle-Single"

TextBox3.BorderStyle = 1

Else

'Change TextBox1 back to BorderStyle

TextBox1.Text = "BorderStyle-Single"

TextBox1.BorderStyle = 1

'Change TextBox3 back to Etched

TextBox3.Text = "Etched"

TextBox3.SpecialEffect = 3

End If

End Sub

Sub ToggleButton2_Click()

'Set background to Opaque or Transparent

If ToggleButton2.Value = True Then

'Change TextBox2 to a transparent background

TextBox2.BackStyle = 0

Else

'Change TextBox2 back to opaque background

TextBox2.BackStyle = 1

End If

End Sub


Column Property Example

'

The following example loads a two-dimensional array with data and, in turn, loads two ListBox controls using the Column and List properties. Note that the Column property transposes the array elements during loading.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains two ListBox controls named ListBox1 and ListBox2.

Dim MyArray(6,3)

Sub Item_Open()

    Dim i

    Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").ListBox1

    Set ListBox2 = Item.GetInspector.ModifiedFormPages("P.2").ListBox2

    ListBox1.ColumnCount = 3        'The 1st list box contains 3 data columns

    ListBox2.ColumnCount = 6        'The 2nd box contains 6 data columns

    'Load integer values into first column of MyArray

    For i = 0 To 5

        MyArray(i, 0) = i

    Next

    'Load columns 2 and three of MyArray

    MyArray(0, 1) = "Zero"

    MyArray(1, 1) = "One"

    MyArray(2, 1) = "Two"

    MyArray(3, 1) = "Three"

    MyArray(4, 1) = "Four"

    MyArray(5, 1) = "Five"

    MyArray(0, 2) = "Zero"

    MyArray(1, 2) = "Un ou Une"

    MyArray(2, 2) = "Deux"

    MyArray(3, 2) = "Trois"

    MyArray(4, 2) = "Quatre"

    MyArray(5, 2) = "Cinq"

    'Load data into ListBox1 and ListBox2

    ListBox1.List() = MyArray

    ListBox2.Column() = MyArray

End Sub


ColumnWidths Property Example

The following example uses the ColumnWidths property to change the column widths of a multicolumn ListBox. The example uses three TextBox controls to specify the individual column widths and uses the Exit event to specify the units of measure of each TextBox.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A ListBox named ListBox1.

•	Three custom text fields named Text1, Text2, and Text3.

•	Three TextBox controls named TextBox1, TextBox2, and TextBox3 that are bound to the custom text fields above.

•	A CommandButton named CommandButton1.

Try entering the value 0 to hide a column.

Dim MyArray(2, 3)

Dim ListBox1

Dim TextBox1

Dim TextBox2

Dim TextBox3

Dim CommandButton1

Sub Item_Open()

Dim i, j, Rows

Set ListBox1 = Item.GetInspector.ModifiedFormPages("P.2").ListBox1

Set TextBox1 = Item.GetInspector.ModifiedFormPages("P.2").TextBox1

Set TextBox2 = Item.GetInspector.ModifiedFormPages("P.2").TextBox2

Set TextBox3 = Item.GetInspector.ModifiedFormPages("P.2").TextBox3

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton1

ListBox1.ColumnCount = 3

Rows = 2

For j = 0 To ListBox1.ColumnCount - 1

For i = 0 To Rows - 1

MyArray(i, j) = "Row " & i & ", Column " & j

Next

Next

ListBox1.List() = MyArray           'Load MyArray into ListBox1

TextBox1.Text = "1 in"              '1-inch columns initially

TextBox2.Text = "1 in"

TextBox3.Text = "1 in"

End Sub

Sub CommandButton1_Click()

'ColumnWidths requires a value for each column separated by semicolons

ListBox1.ColumnWidths = TextBox1.Text & ";" & TextBox2.Text & ";" & TextBox3.Text

End Sub

Sub Item_CustomPropertyChange(ByVal Name)

msgbox Name

Select Case Name

Case "Text1"

  'ColumnWidths accepts points (no units), inches or centimeters; make inches the default

If Not (InStr(TextBox1.Text, "in") > 0 Or InStr(TextBox1.Text, "cm") > 0) Then

TextBox1.Text = TextBox1.Text & " in"

End If

Case "Text2"

'ColumnWidths accepts points (no units), inches or centimeters; make inches the default

If Not (InStr(TextBox2.Text, "in") > 0 Or InStr(TextBox2.Text, "cm") > 0) Then

TextBox2.Text = TextBox2.Text & " in"

End If

Case "Text3"

'ColumnWidths accepts points (no units), inches or centimeters; make inches the default

If Not (InStr(TextBox3.Text, "in") > 0 Or InStr(TextBox3.Text, "cm") > 0) Then

TextBox3.Text = TextBox3.Text & " in"

End If

End Select

End Sub


ControlTipText Property Example

The following example defines the ControlTipText property for three CommandButton controls and two Page objects in a MultiPage.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A MultiPage named MultiPage1.

•	Three CommandButton controls named CommandButton1 through CommandButton3.

Note   For an individual Page of a MultiPage, ControlTipText becomes enabled when the MultiPage or a control on the current page of the MultiPage has the focus.

Sub Item_Open()

  Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").MultiPage1

  Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton1

  Set CommandButton2 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton2

  Set CommandButton3 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton3

  MultiPage1.Page1.ControlTipText = "Here in page 1"

  MultiPage1.Page2.ControlTipText = "Now in page 2"

  CommandButton1.ControlTipText = "And now here's"

  CommandButton2.ControlTipText = "a tip from"

  CommandButton3.ControlTipText = "your controls!"

End Sub


Picture, PicturePosition Properties Example

The following example uses a ComboBox to show the picture placement options for a control. Each time the user clicks a list choice, the picture and caption are updated on the CommandButton. This code sample also uses the AddItem method to populate the ComboBox choices.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A Label named Label1.

•	A CommandButton named CommandButton1 with the Picture property set to use an image on your computer.

•	A ComboBox named ComboBox1.

Dim Label1

Dim CommandButton1

Dim ComboBox1

Sub Item_Open()

Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Label1

Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton1

Set ComboBox1 = Item.GetInspector.ModifiedFormPages("P.2").ComboBox1

Label1.Left = 18

Label1.Top = 12

Label1.Height = 12

Label1.Width = 190

Label1.Caption = "Select picture placement relative to the caption."

'Add list entries to combo box. The value of each entry matches the

'corresponding ListIndex value in the combo box.

ComboBox1.AddItem "Left Top"        'ListIndex = 0

ComboBox1.AddItem "Left Center"     'ListIndex = 1

ComboBox1.AddItem "Left Bottom"     'ListIndex = 2

ComboBox1.AddItem "Right Top"       'ListIndex = 3

ComboBox1.AddItem "Right Center"    'ListIndex = 4

ComboBox1.AddItem "Right Bottom"    'ListIndex = 5

ComboBox1.AddItem "Above Left"      'ListIndex = 6

ComboBox1.AddItem "Above Center"    'ListIndex = 7

ComboBox1.AddItem "Above Right"    'ListIndex = 8

ComboBox1.AddItem "Below Left"      'ListIndex = 9

ComboBox1.AddItem "Below Center"    'ListIndex = 10

ComboBox1.AddItem "Below Right"    'ListIndex = 11

ComboBox1.AddItem "Centered"        'ListIndex = 12

ComboBox1.Style = 2  'Use drop-down list

ComboBox1.BoundColumn = 0            'Combo box values are ListIndex values

ComboBox1.ListIndex = 0              'Set combo box to first entry

ComboBox1.Left = 18

ComboBox1.Top = 36

ComboBox1.Width = 90

ComboBox1.ListWidth = 90

'Initialize CommandButton1

CommandButton1.Left = 230

CommandButton1.Top = 36

CommandButton1.Height = 120

CommandButton1.Width = 120

'Note: Be sure to refer to have set the CommandButton1 to a bitmap file

      'Note: that is present on your system

CommandButton1.PicturePosition = ComboBox1.Value

End Sub

Sub ComboBox1_Click()

Select Case ComboBox1.Value

Case 0  'Left Top

CommandButton1.Caption = "Left Top"

CommandButton1.PicturePosition = 0

Case 1  'Left Center

CommandButton1.Caption = "Left Center"

CommandButton1.PicturePosition = 1

Case 2  'Left Bottom

CommandButton1.Caption = "Left Bottom"

CommandButton1.PicturePosition = 2

Case 3  'Right Top

CommandButton1.Caption = "Right Top"

CommandButton1.PicturePosition = 3

Case 4  'Right Center

CommandButton1.Caption = "Right Center"

CommandButton1.PicturePosition = 4

Case 5  'Right Bottom

CommandButton1.Caption = "Right Bottom"

CommandButton1.PicturePosition = 5

Case 6  'Above Left

CommandButton1.Caption = "Above Left"

CommandButton1.PicturePosition = 6

Case 7  'Above Center

CommandButton1.Caption = "Above Center"

CommandButton1.PicturePosition = 7

Case 8  'Above Right

CommandButton1.Caption = "Above Right"

CommandButton1.PicturePosition = 8

Case 9  'Below Left

CommandButton1.Caption = "Below Left"

CommandButton1.PicturePosition = 9

Case 10 'Below Center

CommandButton1.Caption = "Below Center"

CommandButton1.PicturePosition = 10

Case 11 'Below Right

CommandButton1.Caption = "Below Right"

CommandButton1.PicturePosition = 11

Case 12 'Centered

CommandButton1.Caption = "Centered"

CommandButton1.PicturePosition = 12

End Select

End Sub


Accessing Controls Through the Controls Collection Example

The following example accesses individual controls from the Controls collection using a For Each...Next loop. When the user presses CommandButton1, the other controls are placed in a column along the left edge of the form using the Move method.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains a CommandButton named CommandButton1 and several other controls.

Dim CtrlHeight

Dim CtrlTop

Dim CtrlGap

Dim CommandButton1

Sub Item_Open()

  Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton1

  CtrlHeight = 20

  CtrlGap = 5

  CommandButton1.Caption = "Click to move controls"

  CommandButton1.AutoSize = True

  CommandButton1.Left = 120

  CommandButton1.Top = CtrlTop

End Sub

Sub CommandButton1_Click()

  Dim MyControl

  Set AllControls = Item.GetInspector.ModifiedFormPages("P.2").Controls

  CtrlTop = 5

  For i = 0 to AllControls.Count - 1

    Set MyControl = AllControls(i)

    If MyControl.Name = "CommandButton1" Then

'Don't move or resize this control.

    Else

      'Move method using unnamed arguments (left, top, width, height)

      MyControl.Move 5, CtrlTop, ,CtrlHeight

      'Calculate top coordinate for next control

      CtrlTop = CtrlTop + CtrlHeight + CtrlGap

    End If

  Next

End Sub


Cycle Property Example

The following example defines the Cycle property for a Frame and two Page objects in a MultiPage.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	A Frame named Frame1.

•	A MultiPage named MultiPage1 that contains two objects named Page1 and Page2.

•	Two CommandButton controls named CommandButton1 and CommandButton2.

In the form, the Frame, and each Page of the MultiPage, place a couple of controls, so you can see how Cycle affects the tab order of the Frame and MultiPage.

The user should tab through the controls to observe how Cycle affects the tab order. Pressing CommandButton1 extends the tab order to include controls in the Frame and Page objects. Pressing CommandButton2 restricts the tab order.

Dim Frame1

Dim MultiPage1

Sub Item_Open()

  Set Frame1 = Item.GetInspector.ModifiedFormPages("P.2").Frame1

  Set MultiPage1 = Item.GetInspector.ModifiedFormPages("P.2").MultiPage1

  RestrictCycles

End Sub

Sub RestrictCycles()

  'Limit tab order for the Frame and Page objects

  Frame1.Cycle = 2

  MultiPage1.Page1.Cycle = 2

  MultiPage1.Page2.Cycle = 2

End Sub

Sub CommandButton1_Click()

  'Extend tab order subforms (the Frame and Page objects)

  Frame1.Cycle = 0

  MultiPage1.Page1.Cycle = 0

  MultiPage1.Page2.Cycle = 0

End Sub

Sub CommandButton2_Click()

  RestrictCycles

End Sub


Move Method Example for Controls Collection

The following example demonstrates moving all the controls on a form by using the Move method with the Controls collection. The user clicks on the CommandButton to move the controls.

To use this example, copy this sample code to the Script Editor of a form. Make sure that the form contains a CommandButton named CommandButton1 and several other controls.

Sub CommandButton1_Click()

  Set Controls = Item.GetInspector.ModifiedFormPages("P.2").Controls

  'Move each control on the form right 25 points and up 25 points.

  Controls.Move 25, -25

End Sub


Parent Property Example

The following example uses the Parent property to refer to the control or form that contains a specific control.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

•	Two Label controls named Label1 and Label2.

•	A CommandButton named CommandButton1.

•	One or more additional controls of your choice.

Dim MyControl

Dim MyParent

Dim ControlsIndex

Sub Item_Open()

  Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton1

  ControlsIndex = 0

  CommandButton1.Caption = "Get Control and Parent"

  CommandButton1.AutoSize = True

  CommandButton1.WordWrap = True

End Sub

Sub CommandButton1_Click()

  Set Label1 = Item.GetInspector.ModifiedFormPages("P.2").Label1

  Set Label2 = Item.GetInspector.ModifiedFormPages("P.2").Label2

  'Process Controls collection for UserForm

  Set MyControl = Item.GetInspector.ModifiedFormPages("P.2").Controls.Item(ControlsIndex)

  Set MyParent = MyControl.Parent

  Label1.Caption = MyControl.Name

  Label2.Caption = MyParent.Name

  'Prepare index for next control on Userform

  ControlsIndex = ControlsIndex + 1

  If ControlsIndex >= Item.GetInspector.ModifiedFormPages("P.2").Controls.Count Then

    ControlsIndex = 0

  End If

End Sub


About custom fields and data types

You can use custom fields in several ways in Outlook.

•	You can create new data-entry fields for a view or form so users can add their own custom information. For example, you can create a Date/Time field called Last Talked To in a contact folder and then add the field to a Phone List view.

•	You can create new views by combining the standard fields in a single column. For example, you can create a column that combines the State and Country fields in an address list to save space.

•	You can create a formula field to show information in a new way. For example, you can create a field that displays "Large" when a message is more than 10,000 bytes and "Small" when a message is under the same limit.

Any field you create is stored in the folder you create it in. To use a field in more than one folder, you must recreate the field in each folder.

You can create and view custom fields in table views and card views. You can create custom fields with the following data types in Outlook.

Data type	Use to represent
Combination	Combinations of values of fields and text in a column (table) or row (card). You can specify whether to show each field or show only the first non-empty field. You can also combine text with fields without the use of quotation marks. For examples of combination fields you can create, click  [image].
Currency	Numeric data as currency or mathematical calculations that involve money.
Date/Time	Date and time data.
Duration	Numeric data. You can enter a duration as minutes, hours, or days. Values are saved as minutes.
Formula	Calculations based on standard and custom fields. You can use any appropriate functions and operators to complete the formula. For examples of formula fields you can create, click  [image].
Integer	Non-decimal numeric data.
Keywords	When filled in, this user-defined field is used to group and find related items similar to the way the Categories field is used in Outlook. Text with multiple values to be separated by commas. Each value can be grouped individually in a view.
Number	Numeric data or mathematical calculations except those that involve money. (For money, use Currency data type.)
Percent	Numeric data as a percentage.
Text	Text or combinations of text and numbers, such as addresses. Can be up to 255 characters long.
Yes/No	Data that contains only one of two values, such as Yes/No, True/False, On/Off. Yes/No fields can also be displayed as  [image]  or  [image].
Each of the data types except Combination, Formula, and Keywords has a series of standard formats you can use to show the values of the fields. For information about standard formats you can use with data types, click  [image].


Create a custom field

In Outlook, you can create different types of custom fields based on the data type you select. For information about the data types you can use, click  [image].

•	If you want to enter and show information about an item, you can create a simple field with one data type. For example, if you want to enter a date, you can create a Date/Time field.

•	If you want to show more than one field in a column in a table (or in a row in a card), you can create a combination field with a Combination data type. You can either show all the selected fields joined together in a column or show only the first non-empty field. This is useful if you want to optimize the use of screen space in a view.

•	If you want to show the results of calculations on standard fields or fields you create, you can create a formula field. For information about the standard fields for items in Outlook, click  [image]. For information about the functions you can use, click  [image].

What do you want to do?

Create a simple field for a folder

Create a combination field for a folder

Create a formula field for a folder


Create a simple field for a folder

1	Select the folder you want to create the field for.

2	In the Current View box  [image], click a view based on the table or card view type.

3	On the View menu, click Show Fields.

Show me

4	Click New Field.

5	In the Name box, type a name for the field.

6	In the Type box, click the data type you want for the field. Do not select Combination or Formula.

For information about standard formats for data types, click  [image].

7	In the Format box, select the format you want for the field.

8	Click OK.

9	Click Move Up and Move Down to position the field between the other fields in the view.

To remove the field from the view, click Remove.

Tip   You can modify the contents of a field directly in a table. For information, click  [image].


Create a combination field for a folder

1	Select the folder you want to create the combination field for.

2	In the Current View box  [image], click a view based on the table or card view type.

3	On the View menu, click Show Fields.

Show me

4	Click New Field.

5	In the Name box, type a name for the field.

6	In the Type box, click Combination.

7	Click Edit.

8	To append each value for the fields you want to use together, click Joining fields and any text fragments to each other.

To show only the first field that is not blank, click Showing only the first non-empty field, ignoring subsequent ones.

9	Click Field, point to the field set you want, and then click the field you want to appear.

10	Repeat step 9 to add each field you want to appear.

11	Click OK twice.

12	Click Move Up and Move Down to position the field between the other fields in the view.

To remove the field from the view, click Remove.

Notes

•	Combination fields appear with the default format of the data type used. To display a data type with a custom format, you must create a formula field and use the Format function.

•	You cannot sort, group, or filter the contents of a combination field.


Create a formula field for a folder

1	Select the folder you want to create the formula field for.

2	In the Current View box  [image], click a view based on the table or card view type.

3	On the View menu, click Show Fields.

Show me

4	Click New Field.

5	In the Name box, type a name for the field.

6	In the Type box, click Formula.

7	Click Edit.

8	To insert a function in the formula, click Function, point to the function set you want, and then click the formula you want. For information about the functions you can use to create a formula, click  [image]. For information about the operators you can use, click  [image].

To insert a field in the formula, select the argument you want to replace, click Field, point to the field set you want, and then click the field you want. For information about standard fields for each item type in Outlook, click  [image].

9	Click OK twice.

10	Click Move Up and Move Down to position the field between the other fields in the view.

To remove the field from the view, click Remove.

Notes

•	Formula fields are updated with any change to a view. For example, if you change the width of a column, the formula fields are updated.

•	You cannot sort, group, or filter the contents of a formula field.


Examples of standard formats for data types

You can format fields you create with different formats based on the data type. The following table provides a list of some of the formats Outlook includes.

For a complete list of standard formats available for a field in a view, click Format Columns on the View menu. Select the field you want to format in the Available fields box, and then select a format in the Format box. If you don't find the format you want, you can create a custom format with a Formula data type and the Format function. For information about the Format function, click  [image].

Data type	Standard format examples
Currency	$12,345.60 or ($12,345.60) $12,346 or ($12,346)
Date/Time	Monday, March 03, 1997 8:00 AM 3/03/97 8:00 AM March 3, 1997 Mon 3/3 8:00 AM 8:00 AM
Duration	12h 12 hours 12h (Work Time) (see the Note below) 12 hours (Work Time) (see the Note below)
Integer	1,234
Keywords	Text
Number	All Digits: 1,234.567 or -1,234.567 Truncated: 1,235 or -1,235 Scientific: 1235E+03 or -1235E+03 Computer: 64 K or 128MB or 1 GB
Percent	65.4321% 65.43% or -65.43% 65% or -65%
Text	Text
Yes/No	Yes or No On or Off True or False   or
Note   Values entered in a field of a Duration data type with a regular format assume a 24-hour day.


Difference between a field and a column

Usually, a column in a table contains the value of a single field, such as the Received field. However, you can show several fields in a column by using a Formula or Combination field. Fields can also be shown as rows in a card view or as controls on a form. A column is just one way to show the contents of a field.


View all standard fields for an item

1	Open the item you want to show fields for.

2	On the Tools menu, click Design Outlook Form, and then click the (All Fields) tab.

3	In the Select from box, click All ItemName Fields.

Notes

•	You cannot show all fields for a note.

•	To view all fields in a Contact item, open the item, and then click the All Fields tab.


Make changes to a custom field in a table

1	Select the folder you want to change a custom field for.

2	In the Current View box  [image], click a view based on the table view type.

3	Right-click the column heading of the custom field, and then click Format Columns on the shortcut menu.

4	Select the options you want.


Examples of Formula and Combination fields

What you want to show	Custom field	Result in custom field
Number of days since the item was received. (Formula field)	DateValue (Now())-DateValue ([Received]) & " Day(s)"	6 Day(s)
Description of a meeting or appointment in Calendar. (Formula field)	"This meeting occurs " & [Recurrence Pattern] & " in " & [Location]	The meeting occurs every day from 12:00 P.M. to 1:30 P.M. in room 1231
Amount to be charged for a phone call recorded in the Journal at .75 a minute. (Formula field)	IIF ([Entry Type] = "Phone call" , Format ([Duration] * .75, "Currency"), "None")	$1.50
Description of a Message Flag. (Formula field)	IIF ( [Flag Status] = "2", [Message Flag] & " " & [Due By],"")	Follow up 3/5/97 8:00:00 A.M.
The first phone number recorded for a contact, in order of appearance in the formula. (Combination field)	[Business Phone] [Business Phone 2] [Home Phone] [Home Phone 2] [Car Phone]	(555) 555-1234
A description of a field combined with the field itself. (Combination field)	Task Due: [Due Date]	Task Due: 3/5/97 8:00:00 A.M.


Troubleshoot custom fields

What do you need help with?

The custom field I created is not visible.

When I try to sort, group, or filter a formula field or combination field, I receive an error message.

The formula field I created does not appear in the Find dialog box.


The custom field I created is not visible.

•	Custom fields are stored in the folder you create them in. Open the folder you created the custom field in to see if it is visible. You must recreate a custom field for each folder you want to use it in.

•	Custom fields are stored in the field set called User-defined fields in the Field Chooser and in the Show Fields dialog box. To see all the custom fields in a folder, open the folder. On the View menu, click Show Fields. In the Select available fields from box, click User-defined fields in folder.


When I try to sort, group, or filter a formula field or combination field, I receive an error message.

You cannot sort, group, or filter a formula field or combination field in Outlook.


About standard fields in Microsoft Outlook

Microsoft Outlook provides the following standard fields. Some fields are available in individual items, and you can add and remove all fields from a table or card view type. For information about how to add and remove fields from a view, click  [image]. For information about how to view all the fields for an item, click  [image].

The value for fields with the Yes/No data type is saved as -1 or 0. The value for fields with the Duration data type is saved as minutes.

What do you want more information about?

Standard fields in a Calendar item

Standard fields in a contact

Standard fields in a journal entry

Standard fields in a mail message

Standard fields in a note

Standard fields in a task

Standard fields in a post	Standard fields in a News item%


Standard fields in a Calendar item

Field	Data type and meaning	Edit in view
All Day Event	Yes/No. If set to Yes, the Duration field is set to 24 hours (1440 minutes).	Yes
Attachment	Yes/No.	No
Billing Information	Text.	Yes
Categories	Text. Field used to group and find related items. Multiple categories are separated by commas.	Yes
Conversation	Text. Value of the Subject field in the original message in a conversation.	No
Created	Date/Time. Date and time the Calendar item is created.	No
Do Not AutoArchive	Yes/No. Specifies whether to archive the Calendar item.	Yes
Duration	Duration. 24 hours (1440 minutes) if the All Day Event field is set to Yes. Otherwise, the difference between the values of the End and Start fields. Saved as minutes.	No
End	Date/Time. End date and time of a Calendar item.	Yes
Importance	The following settings apply. 0 Low importance 1 Normal importance 2 High importance	Yes
In Folder	Text. Name of the folder that contains the Calendar item.	No
Location	Text. Location of a meeting or appointment.	Yes
Meeting Status	The following settings apply. 0 None 1 Meeting organizer 2 Tentatively accepted 3 Accepted 4 Declined 5 Not yet accepted	No
Message Class	Specifies the message class for the type of item. For information about the standard Outlook message classes, click  [image].	No
Mileage	Text.	Yes
Modified	Date/Time. Last time the Calendar item was modified.	No
Notes	Text. Value of the text box of a Calendar item.	No
Optional Attendees	Text. Names of optional attendees for a meeting or appointment. Multiple names are separated by semicolons.	No
Organizer	Text. Name of the organizer of a meeting or appointment.	No
Outlook Internal Version	For administrator use only	No
Outlook Version	Text. Version of Outlook that the Calendar item is created in.	No
Read	Yes/No. Specifies whether the Calendar item has been marked as read.	No
Recurrence	The following settings apply. 0 None 1 Daily 2 Weekly 3 Monthly 4 Yearly	No
Recurrence Pattern	Text. Combination of the values of the Recurrence, Start, and End fields.	No
Recurrence Range End	Date/Time. Last date and time of a recurring Calendar item.	No
Recurrence Range Start	Date/Time. First date and time of a recurring Calendar item.	No
Recurring	Yes/No. Specifies whether the Calendar item recurs.	No
Remind Beforehand	Number. Minutes before the reminder runs prior to a meeting or appointment.	Yes
Reminder	Yes/No. If the Start time for the meeting or appointment has already passed, the Reminder field cannot be set.	Yes
Reminder Override Default	Yes/No. If set to Yes, the Remind Beforehand, Reminder Sound, and Reminder Sound File fields are used to control the reminder for the item. If set to No, the options on the Reminders tab in the Options dialog box (Tools menu) are used.	Yes
Reminder Sound	Yes/No. Specifies whether to play the sound file as a reminder.	Yes
Reminder Sound File	Text. Path of the sound file to be played as a reminder.	Yes
Required Attendees	Text. Names of required attendees for a meeting or appointment. Multiple names are separated by semicolons.	No
Resources	Text. Names of resources for a meeting or appointment. Multiple names are separated by semicolons.	No
Response Requested	Yes/No. In a meeting request, specifies whether the recipient has been asked to respond.	Yes
Sensitivity	The following settings apply. 0 Normal 1 Personal 2 Private 3 Confidential	No
Show Time As	The following settings apply. 0 Free 1 Tentative 2 Busy 3 Out of Office	Yes
Size	Number. Number of bytes used by the Calendar item.	No
Start	Date/Time. Start time of a Calendar item.	Yes
Subject	Text.	Yes


Standard fields in a contact

Field	Data type and meaning	Edit in view
Account	Text.	Yes
Anniversary	Date/Time. When the Anniversary field has a value, a Calendar item is attached to the contact, and the Attachment field is set to Yes.	Yes
Assistant's Name	Text.	Yes
Assistant's Phone	Text.	Yes
Attachment	Yes/No. Set to Yes when the Anniversary or Birthday field is a non-empty field.	No
Billing Information	Text.	Yes
Birthday	Date/Time. When the Birthday field has a value, a Calendar item is attached to the contact, and the Attachment field is set to Yes.	Yes
Business Address	Text.	Yes (Card view only)
Business Address City	Text.	Yes
Business Address Country	Text.	Yes
Business Address PO Box	Text.	Yes
Business Address Postal Code	Text.	Yes
Business Address State	Text.	Yes
Business Address Street	Text.	Yes (Card view only)
Business Fax	Text.	Yes
Business Home Page	Text.	Yes
Business Phone	Text.	Yes
Business Phone 2	Text.	Yes
Callback	Text.	Yes
Car Phone	Text.	Yes
Categories	Text. Field used to group and find related items. Multiple categories are separated by commas.	Yes
Children	Text.	Yes
City	Text.	Yes
Company	Text.	Yes
Company Main Phone	Text.	Yes
Computer Network Name	Text.	Yes
Country	Text.	Yes
Created	Date/Time. The date and time the contact is created.	No
Customer ID	Text.	Yes
Department	Text.	Yes
E-mail	Text.	No
E-mail 2	Text.	No
E-mail 3	Text.	No
File As	Text. Value of the Full Name field, unless modified by the user.	No
First Name	Text.	Yes
FTP Site	Text. FTP site name for the contact.	Yes
Full Name	Text. Value of the Title, First, Middle, Last, and Suffix fields of the item, separated by spaces. Any changes made to the Full Name field are reflected in its component fields.	Yes
Gender	The following settings apply. 0 Unspecified 1 Female 2 Male	Yes
Government ID Number	Text.	Yes
Hobbies	Text.	Yes
Home Address	Text.	Yes (Card view only)
Home Address City	Text.	Yes
Home Address Country	Text.	Yes
Home Address PO Box	Text.	Yes
Home Address Postal Code	Text.	Yes
Home Address State	Text.	Yes
Home Address Street	Text.	Yes (Card view only)
Home Fax	Text.	Yes
Home Phone	Text.	Yes
Home Phone 2	Text.	Yes
In Folder	Text. Name of the folder that contains the contact.	Yes
Initials	Text.	Yes
ISDN	Text. Phone number for ISDN connection.	Yes
Job Title	Text.	Yes
Journal	Yes/No. Specifies whether activities are automatically recorded in the Journal for the contact.	Yes
Language	Text.	Yes
Last Name	Text.	Yes
Location	Text.	Yes
Mailing Address	Text.	Yes (Card view only)
Manager Name	Text.	Yes
Message Class	Text. Specifies the message class for the type of item. For information about the standard message classes, click  [image].
Middle Name	Text.	Yes
Mileage	Text.	Yes
Mobile Phone	Text.	Yes
Modified	Date/Time. Last date and time the contact was modified.	No
Nickname	Text.	Yes
Notes	Text. Value of the text box of the contact.	No
Office Location	Text.	Yes
Organizational ID Number	Text.	Yes
Other Address	Text.	Yes (Card view only)
Other Address City	Text.	Yes
Other Address Country	Text.	Yes
Other Address PO Box	Text.	Yes
Other Address Postal Code	Text.	Yes
Other Address State	Text.	Yes
Other Address Street	Text.	Yes (Card view only)
Other Fax	Text.	Yes
Other Phone	Text.	Yes
Outlook Internal Version	For administrator use only	No
Outlook Version	Text. Version of Outlook that the contact is created in.	No
Pager	Text.	Yes
Personal Home Page	Text.	Yes
PO Box	Text.	Yes
Primary Phone	Text.	Yes
Profession	Text.	Yes
Radio Phone	Text.	Yes
Read	Yes/No. Specifies whether the contact has been marked as read.	No
Referred By	Text.	Yes
Reminder Time	Date/Time. Date and time that a reminder is run for a contact.	Yes
Sensitivity	The following settings apply. 0 Normal 1 Personal 2 Private 3 Confidential	No
Size	Number. Number of bytes used by the contact.	No
Spouse	Text.	Yes
State	Text.	Yes
Street Address	Text.	Yes (Card view only)
Subject	Text. Value of the Full Name field. If the Full Name field is empty, the value of the File As field is used.	Yes
Suffix	Text. Name suffix, such as Jr. or Ph.D.	Yes
Telex	Text.	Yes
Title	Text. Name title, such as Mr., Ms., or Mrs.	Yes
TTY/TDD Phone	Text. Phone number for TTY/TDD connection.	Yes
User Certificate	Text.	Yes
User Field 1 – 4	Text. User-defined fields provided for compatibility with other programs. For information about how to create a custom field in Outlook, click  [image].	Yes
Web Page	Text.	Yes
ZIP/Postal Code	Text.	Yes


Standard fields in a journal entry

Field	Data type and meaning	Edit in view
Attachment	Yes/No.	No
Billing Information	Text.	Yes
Categories	Text. User-defined field used to group and find related items. Multiple categories are separated by commas.	Yes
Company	Text.	Yes
Contact	Text. Name of the contact the journal entry is recorded for.	No
Created	Date/Time. Date and time the journal entry is created.	No
Do Not AutoArchive	Yes/No. Specifies whether to archive the journal entry.	Yes
Duration	Duration. Saved as minutes.	No
End	Date/Time. End date and time set for the journal entry.	Yes
Entry Type	Text. Type of entry made for the journal entry.	No
In Folder	Text. Name of the folder that contains the journal entry.	No
Message Class	Text. Specifies the message class for the type of item. For information about the standard Outlook message classes, click  [image].	No
Mileage	Text.	Yes
Modified	Date/Time. Last time the journal entry was modified.	No
Notes	Text. First 255 characters in the text box of the journal entry.	No
Outlook Internal Version	For administrator use only	No
Outlook Version	Text. Version of Outlook that the journal entry is created in.	No
Read	Yes/No. Specifies whether the journal entry has been marked as read.	No
Sensitivity	The following settings apply. 0 Normal 1 Personal 2 Private 3 Confidential	No
Size	Number. Number of bytes used by the journal entry.	No
Start	Date/Time. Start time for the journal entry.	Yes
Subject	Text.	Yes


Standard fields in a mail message

Field	Data type and meaning	Edit in view
Attachment	Yes/No.	No
BCC	Text. Names in the Bcc box of a message.	No
Billing Information	Text.	Yes
Categories	Text. Field used to group and find related items. Multiple categories are separated by commas.	Yes
CC	Text. Names in the Cc box of a message.	No
Conversation	Text. Value of the Subject field in the original message in a conversation.	No
Created	Date/Time. Date and time the message is created.	No
Defer Until	Date/Time. Date and time a message is to be delivered. The server delays delivery of the message.	Yes
Do Not AutoArchive	Yes/No. Specifies whether to archive the message.	Yes
Due By	Date/Time. Date and time the action associated with a Message Flag is set to be completed by. When a value is entered for Due By, the Flag Status field is set to 2.	Yes
Expires	Date/Time. Date and time a message expires.	Yes
Flag Status	The following settings apply. 0 Normal 1 Completed 2 Flagged	Yes
From	Text. Names in the From box in a message.	No
Have Replies Sent To	Text. Names in the Have replies sent to box in a message.	No
Importance	The following settings apply. 0 Low importance 1 Normal importance 2 High importance	Yes
In Folder	Text. Name of the folder that contains the message.	No
Message	Text. Value of the text box in a message.	No
Message Class	Specifies the message class for the type of item. For information about the standard message classes, click  [image].	No
Message Flag	Text. Action associated with a Message Flag. When a value is entered for Message Flag, the Flag Status field is set to 2.	Yes
Mileage	Text.	Yes
Modified	Date/Time. Last date and time the message was modified.	No
Outlook Internal Version	For administrator use only	No
Outlook Version	Text. Version of Outlook that the message is created in.	No
Read	True/False. Specifies whether the message has been marked as read.	No
Received	Date/Time. Date and time the message is received.	No
Remote Status	Specifies the status of Remote Mail header. The following settings apply. 0 None 1 Marked 2 Marked for download 3 Marked for copy	No
Retrieval Time	Duration. Specifies the time it takes to download the message with Remote Mail. Saved as minutes.	No
Sensitivity	The following settings apply. 0 Normal 1 Personal 2 Private 3 Confidential	No
Sent	Date/Time. Date and time the message is sent.	No
Size	Number. Number of bytes used by the message.	No
Subject	Text.	Yes
To	Text. Names in the To box in a message.	No
Tracking Status	Tracking status of a message. The following settings apply. 1 Delivered 5 Read 6 Not Read	No


Standard fields in a note

Field	Data type and meaning	Edit in view
Categories	Text. Field used to group and find related items. Multiple categories are separated by commas.	Yes
Color	The following settings apply. 0 Blue 1 Green 2 Pink 3 Yellow 4 White	Yes
Content	Text. Value of the text box of a note.	No
Created	Date/Time. Date and time the note is created.	No
Do Not AutoArchive	Yes/No. Specifies whether to archive the note.	Yes
In Folder	Text. Name of the folder that contains the note.	No
Message Class	Text. Specifies the message class for the type of item. For information about the standard Outlook message classes, click  [image].	No
Modified	Date/Time. Last date and time the note was modified.	No
Outlook Internal Version	For administrator use only	No
Outlook Version	Text. Version of Outlook that the note is created in.	No
Read	Yes/No. Specifies whether the note has been marked as read.	No
Size	Number. Number of bytes used by the note.	No
Subject	Text.	No


Standard fields in a task

Field	Data type and meaning	Edit in view
% Complete	Percent.	Yes
Actual Work	Duration. Time spent on a task. Saved as minutes.	Yes
Assigned	The following settings apply. 0 Not assigned 1 Assigned by me 2 Assigned to me	No
Attachment	Yes/No.	No
Billing Information	Text.	Yes
Categories	Text. Field used to group and find related items. Multiple categories are separated by commas.	Yes
Company	Text.	Yes
Complete	Yes/No. Specifies whether the task is marked as completed.	Yes
Contacts	Text.	Yes
Conversation	Text. Value of the Subject field of the original task.	No
Created	Date/Time. Date and time the task is created.	No
Date Completed	Date/Time. Date and time the task is completed. If the Date Completed field has a value, the Complete field is set to Yes, and the % Complete field is set to 100.	Yes for non-recurring tasks. No for recurring tasks.
Do Not AutoArchive	Yes/No. Specifies whether to archive the task.	Yes
Due Date	Date/Time.	Yes
In Folder	Text. Name of the folder that contains the task.	No
Message Class	Text. Specifies the message class of the type of item. For information about the standard Outlook message classes, click  [image].	No
Mileage	Text.	Yes
Modified	Date/Time. Last date and time the task was modified.	No
Notes	Text. Value of the text box of the task.	Yes
Outlook Internal Version	For administrator use only	No
Outlook Version	Text. Version of Outlook that the task is created in.	No
Owner	Text. Owner of the task.	Yes, if task is in a public folder; otherwise, No.
Priority	The following settings apply. 0 Low priority 1 Normal priority 2 High priority	Yes
Read	Yes/No. Specifies whether the task has been marked as read.	No
Recurring	Yes/No. Specifies whether the task recurs.	No
Reminder	Yes/No. Specifies whether a reminder has been set for the task.	No
Reminder Override Default	Yes/No.	Yes
Reminder Sound	Yes/No. Specifies whether to play the sound file as a reminder.	Yes
Reminder Sound File	Text. Path of the sound file to be played as a reminder.	Yes
Reminder Time	Date/Time. Date and time that a reminder is run for a task.	Yes
Request Status	The following settings apply. 0 No setting 1 Not responded 2 Accepted 3 Declined	No
Requested By	Text. In a task request, the person’s name who assigned the task.	No
Role	Text.	Yes
Schedule+ Priority	Text.	Yes
Sensitivity	The following settings apply. 0 Normal 1 Personal 2 Private 3 Confidential	No
Size	Number. Number of bytes used by the task.	No
Start Date	Date/Time. Start date and time for the task.	Yes
Status	The following settings apply. 0 Not Started 1 In Progress 2 Completed 3 Waiting on someone else 4 Deferred	Yes
Subject	Text.	Yes
Team Task	Yes/No.	Yes
Total Work	Duration. Time the task is expected to take. Saved as minutes.	Yes


Standard fields in a post

Field	Data type and meaning	Edit in view
Attachment	Yes/No.	No
Billing Information	Text.	Yes
Categories	Text. Field used to group and find related items. Multiple categories are separated by commas.	Yes
Conversation	Text. Value of the Subject field in the original item in a conversation.	No
Created	Date/Time. Date and time the message is created.	No
Defer Until	Date/Time. Date and time a message is to be delivered. The server delays delivery of the message.	Yes
Do Not AutoArchive	Yes/No. Specifies whether to archive the message.	Yes
Expires	Date/Time. Date and time a message expires.	Yes
From	Text. Names in the From box in a message.	No
Importance	The following settings apply. 0 Low importance 1 Normal importance 2 High importance	Yes
In Folder	Text. Name of the folder that contains the message.	No
Message Class	Specifies the message class for the type of item. For information about the standard message classes, click  [image].	No
Mileage	Text.	Yes
Modified	Date/Time. Last date and time the message was modified.	No
Outlook Internal Version	For administrator use only	No
Outlook Version Name	Text. Version of Outlook that the message is created in.	No
Read	True/False. Specifies whether the message has been marked as read.	No
Received	Date/Time. Date and time the message is received.	No
Remote Status	Specifies the status of Remote Mail header. The following settings apply. 0 None 1 Marked 2 Marked for download 3 Marked for copy	No
Retrieval Time	Duration. Specifies the time it takes to download the message with Remote Mail. Saved as minutes.	No
Sensitivity	The following settings apply. 0 Normal 1 Personal 2 Private 3 Confidential	No
Sent	Date/Time. Date and time the message is sent.	No
Size	Number. Number of bytes used by the message.	No
Subject	Text.	Yes


Abs function

Returns a value of the same type that is passed to it specifying the absolute value of a number.

Syntax

Abs(number)

The required number argument can be any valid numeric expression.  If number contains Null, Null is returned.

Remarks

The absolute value of a number is its unsigned magnitude.  For example, ABS(-1) and ABS(1) both return 1.


Abs function example

The following example returns 53 for both functions.

ABS(-53)

ABS(53)


Asc function

Returns an Integer representing the character code corresponding to the first letter in a string.

Syntax

Asc(string)

The required string argument is any valid string expression.  If the string contains no characters, a run-time error occurs.

Remarks

The range for returns is 0-255 on non-DBCS systems, but -32768-32767 on DBCS systems.

Note   The AscW function returns the character code native to the system (ANSI for Windows 95, Unicode for Windows NT).


Asc function example

The following example returns the character code of the first letter in the Subject field.

Subject field	Function returns
International Sales	73
Marketing Strategy	77
ASC([Subject])


Atn function

Returns a Double specifying the arctangent of a number.

Syntax

Atn(number)

The required number argument is a Double or any valid numeric expression.

Remarks

The Atn function takes the ratio of two sides of a right triangle (number) and returns the corresponding angle in radians.  The ratio is the length of the side opposite the angle divided by the length of the side adjacent to the angle.

The range of the result is -pi/2 to pi/2 radians.

To convert degrees to radians, multiply degrees by pi/180.  To convert radians to degrees, multiply radians by 180/pi.

Note   Atn is the inverse trigonometric function of Tan, which takes an angle as its argument and returns the ratio of two sides of a right triangle.  Do not confuse Atn with the cotangent, which is the simple inverse of a tangent (1/tangent).


Atn function example

The following example uses the Atn function to return the value of pi.

ATN(1)*4


Choose function

Selects and returns a value from a list of arguments.

Syntax

Choose(index, choice-1[, choice-2, ... [, choice-n]])

The Choose function syntax has these parts:

Part	Description
index	Required.  Numeric expression or field that results in a value between 1 and the number of available choices.
choice	Required.  Variant expression containing one of the possible choices.
Remarks

Choose returns a value from the list of choices based on the value of index.  If index is 1, Choose returns the first choice in the list; if index is 2, it returns the second choice, and so on.

You can use Choose to look up a value in a list of possibilities.  For example, if index evaluates to 3 and choice-1 = "one", choice-2 = "two", and choice-3 = "three", Choose returns "three".

Choose evaluates every choice in the list, even though it returns only one.  For this reason, you should watch for undesirable side effects. For example, if the evaluation of any expression results in a division by zero error, an error occurs.

The Choose function returns a Null if index is less than 1 or greater than the number of choices listed.

If index is not a whole number, it is rounded down to the next whole number before being evaluated.


Choose function example

The following examples use the Choose function to display custom values for the value of the Importance field.

Importance field	Function returns
0	Ignore
1	Read Today
2	Read Yesterday
Choose([Importance]+1, "Ignore", "Read Today", "Read Yesterday")


Chr function

Returns a String containing the character associated with the specified character code.

Syntax

Chr(charcode)

The required charcode argument is a Long that identifies a character.

Remarks

Numbers from 0 to 31 are the same as standard, nonprintable ASCII codes.  For example, Chr(10) returns a linefeed character.  The normal range for charcode is 0 – 255. However, on DBCS systems, the actual range for charcode is  – 32768 through 65536.

Note   The ChrW function returns a string containing the character in the format native to the operating system (ANSI for Windows 95, Unicode for Windows NT).


Chr function example

The example returns the character for the following character codes in the CharCode field.

CharCode field	Function returns
65	A
97	a
62	>
37	%
Chr([CharCode])


Cos function

Returns a Double specifying the cosine of an angle.

Syntax

Cos(number)

The required number argument is a Double or any valid numeric expression that expresses an angle in radians.

Remarks

The Cos function takes an angle and returns the ratio of two sides of a right triangle.  The ratio is the length of the side adjacent to the angle divided by the length of the hypotenuse.

The result lies in the range -1 to 1.

To convert degrees to radians, multiply degrees by pi/180.  To convert radians to degrees, multiply radians by 180/pi.


Cos function example

The following example uses the Cos function to return the cosine of the Angle field.

Cos([Angle])


Date function

Returns a Variant (Date) containing the current system date.

Syntax

Date( )


Date function example

The following example uses the Date function to return the current system date.

Date( )


DateAdd function

Returns a Variant (Date) containing a date to which a specified time interval has been added.

Syntax

DateAdd(interval, number, date)

The DateAdd function syntax has these named arguments:

Part	Description
interval	Required.  String expression that is the interval of time you want to add.
number	Required.  Numeric expression that is the number of intervals you want to add.  It can be positive (to get dates in the future) or negative (to get dates in the past).
date	Required.  Variant (Date) or literal representing date to which the interval is added.
Settings

The interval argument has these settings:

Setting	Description
yyyy	Year
q	Quarter
m	Month
y	Day of year
d	Day
w	Weekday
ww	Week
h	Hour
n	Minute
s	Second
Remarks

You can use the DateAdd function to add or subtract a specified time interval from a date.  For example, you can use DateAdd to calculate a date 30 days from today or a time 45 minutes from now.

To add days to date, you can use Day of Year ("y"), Day ("d"), or Weekday ("w").

The DateAdd function won't return an invalid date.  The following example adds one month to January 31:

DateAdd("m", 1, "31-Jan-95")

In this case, DateAdd returns 28-Feb-95, not 31-Feb-95.  If date is 31-Jan-96, it returns 29-Feb-96 because 1996 is a leap year.

If the calculated date would precede the year 100 (that is, you subtract more years than are in date), an error occurs.

If number isn't a Long value, it is rounded to the nearest whole number before being evaluated.


DateAdd function example

The following example takes the date of the Received field and, by using the DateAdd function, displays a corresponding date one month in the future.

DateAdd("m", 1, [Received])


DateDiff function

Returns a Variant (Long) specifying the number of time intervals between two specified dates.

Syntax

DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])

The DateDiff function syntax has these named arguments:

Part	Description
interval	Required.  String expression that is the interval of time you use to calculate the difference between date1 and date2.
date1, date2	Required; Variant (Date).  Two dates you want to use in the calculation.
firstdayofweek	Optional.  Specifies the first day of the week. If not specified, Sunday is assumed.
firstweekofyear	Optional.  Specifies the first week of the year.  If not specified, the first week is assumed to be the week in which January 1 occurs.
Settings

The interval argument has these settings:

Setting	Description
yyyy	Year
q	Quarter
m	Month
y	Day of year
d	Day
w	Weekday
ww	Week
h	Hour
n	Minute
s	Second
The firstdayofweek argument has these settings:

Value	Description
0	Use the NLS API setting.
1	Sunday (default)
2	Monday
3	Tuesday
4	Wednesday
5	Thursday
6	Friday
7	Saturday
The firstweekofyear argument has these settings:

Value	Description
0	Use the NLS API setting.
1	Start with week in which January 1 occurs (default).
2	Start with the first week that has at least four days in the new year.
3	Start with first full week of the year.
Remarks

You can use the DateDiff function to determine how many specified time intervals exist between two dates.  For example, you might use DateDiff to calculate the number of days between two dates, or the number of weeks between today and the end of the year.

To calculate the number of days between date1 and date2, you can use either Day of year ("y") or Day ("d").  When interval is Weekday ("w"), DateDiff returns the number of weeks between the two dates. If date1 falls on a Monday, DateDiff counts the number of Mondays until date2.  It counts date2 but not date1.  If interval is Week ("ww"), however, the DateDiff function returns the number of calendar weeks between the two dates.  It counts the number of Sundays between date1 and date2.  DateDiff counts date2 if it falls on a Sunday; but it doesn't count date1, even if it does fall on a Sunday.

If date1 refers to a later point in time than date2, the DateDiff function returns a negative number.

The firstdayofweek argument affects calculations that use the "w" and "ww" interval symbols.

If date is a date literal, the specified year becomes a permanent part of that date.  However, if date is enclosed in double quotation marks (" "), and you omit the year, the current year is used each time the date expression is evaluated.  This makes it possible to write formulas that can be used in different years.

When comparing December 31 to January 1 of the immediately succeeding year, DateDiff for Year ("yyyy") returns 1 even though only a day has elapsed.


DateDiff function example

The following example uses the DateDiff function to display the number of days between the date in the Received field and the current system date.

DateDiff("d", Now(), [Received])


DatePart function

Returns a Variant (Integer) containing the specified part of a given date.

Syntax

DatePart(interval, date[,firstdayofweek[, firstweekofyear]])

The DatePart function syntax has these named arguments:

Part	Description
interval	Required.  String expression that is the interval of time you want to return.
date	Required.  Variant (Date) value that you want to evaluate.
firstdayofweek	Optional.  Specifies the first day of the week. If not specified, Sunday is assumed.
firstweekofyear	Optional.  Specifies the first week of the year.  If not specified, the first week is assumed to be the week in which January 1 occurs.
Settings

The interval argument has these settings:

Setting	Description
yyyy	Year
q	Quarter
m	Month
y	Day of year
d	Day
w	Weekday
ww	Week
h	Hour
n	Minute
s	Second
The firstdayofweek argument has these settings:

Value	Description
0	Use the NLS API setting.
1	Sunday (default)
2	Monday
3	Tuesday
4	Wednesday
5	Thursday
6	Friday
7	Saturday
The firstweekofyear argument has these settings:

Value	Description
0	Use the NLS API setting.
1	Start with week in which January 1 occurs (default).
2	Start with the first week that has at least four days in the new year.
3	Start with first full week of the year.
Remarks

You can use the DatePart function to evaluate a date and return a specific interval of time  For example, you might use DatePart to calculate the day of the week or the current hour.

The firstdayofweek argument affects calculations that use the "w" and "ww" interval symbols.

If date is a date literal, the specified year becomes a permanent part of that date.  However, if date is enclosed in double quotation marks (" "), and you omit the year, the current year is used each time the date expression is evaluated.  This makes it possible to write formulas that can be used in different years.


DatePart function example

The following example takes the date Received field and, by using the DatePart function, displays the quarter of the year it falls in.

DatePart("q", [Received])


DateSerial function

Returns a Variant (Date) for a specified year, month, and day.

Syntax

DateSerial(year, month, day)

The DateSerial function syntax has these named arguments:

Part	Description
year	Required; Integer.  Number between 100 and 9999, inclusive, or a numeric expression.
month	Required; Integer.  Any numeric expression.
day	Required; Integer.  Any numeric expression.
Remarks

To specify a date, such as December 31, 1991, the range of numbers for each DateSerial argument should be in the accepted range for the unit; that is, 1 – 31 for days and 1 – 12 for months.  However, you can also specify relative dates for each argument using any numeric expression that represents some number of days, months, or years before or after a certain date.

The following example uses numeric expressions instead of absolute date numbers.  Here the DateSerial function returns a date that is the day before the first day (1 - 1), two months before August (8 - 2), 10 years before 1990 (1990 - 10); in other words, May 31, 1980.

DateSerial(1990 - 10, 8 - 2, 1 - 1)

For the year argument, values between 0 and 99, inclusive, are interpreted as the years 1900 – 1999.  For all other year arguments, use a four-digit year (for example, 1800).

When any argument exceeds the accepted range for that argument, it increments to the next larger unit as appropriate.  For example, if you specify 35 days, it is evaluated as one month and some number of days, depending on where in the year it is applied.  If any single argument is outside the range -32,768 to 32,767, an error occurs.  If the date specified by the three arguments falls outside the acceptable range of dates, an error occurs.


DateSerial function example

The following example uses the DateSerial function to return the date for the specified year, month, and day.

DateSerial(1969, 2, 12)


DateValue function

Returns a Variant (Date).

Syntax

DateValue(date)

The required date argument is normally a string expression representing a date from January 1, 100 through December 31, 9999.  However, date can also be any expression that can represent a date, a time, or both a date and time, in that range.

Remarks

If date is a string that includes only numbers separated by valid date separators, DateValue recognizes the order for month, day, and year according to the Short Date format you specified for your system.  DateValue also recognizes unambiguous dates that contain month names, either in long or abbreviated form.  For example, in addition to recognizing 12/30/1991 and 12/30/91, DateValue also recognizes December 30, 1991 and Dec 30, 1991.

If the year part of date is omitted, DateValue uses the current year from your computer's system date.

If the date argument includes time information, DateValue doesn't return it.  However, if date includes invalid time information (such as "89:98"), an error occurs.

In Outlook, you can use a Date/Time field to have dates entered as descriptions converted to a standard Date format.  For information about the types of descriptions that can be entered, click  [image].


DateValue function example

The following example uses the DateValue function to convert a string to a date.

DateValue("February 12, 1969")


Day function

Returns a Variant (Integer) specifying a whole number between 1 and 31, inclusive, representing the day of the month.

Syntax

Day(date)

The required date argument is any Variant, numeric expression, string expression, or any combination, that can represent a date.  If date contains Null, Null is returned.


Day function example

The following example uses the Day function to return the day of the Received field.

Day([Received])


DDB function

Returns a Double specifying the depreciation of an asset for a specific time period using the double-declining balance method or some other method you specify.

Syntax

DDB(cost, salvage, life, period[, factor])

The DDB function has these named arguments:

Part	Description
cost	Required.  Double specifying initial cost of the asset.
salvage	Required.  Double specifying value of the asset at the end of its useful life.
life	Required.  Double specifying length of useful life of the asset.
period	Required.  Double specifying period for which asset depreciation is calculated.
factor	Optional.  Variant specifying rate at which the balance declines. If omitted, 2 (double-declining method) is assumed.
Remarks

The double-declining balance method computes depreciation at an accelerated rate.  Depreciation is highest in the first period and decreases in successive periods.

The arguments life and period must be expressed in the same units.  For example, if life is given in months, period must also be given in months.  All arguments must be positive numbers.

The DDB function uses the following formula to calculate depreciation for a given period:

Depreciation over period = ((cost – salvage) * factor) / life


DDB function example

By using the double-declining balance method, this example uses the DDB function to return the depreciation of an asset for a specified period given the initial cost (InitCost), the salvage value at the end of the asset's useful life (SalvageVal), the total life of the asset in years (LifeTime), and the period for which the depreciation is calculated (Depr), also in years.

DDB([InitCost], [SalvageVal], [LifeTime], [Depr])


Exp function

Returns a Double specifying e (the base of natural logarithms) raised to a power.

Syntax

Exp(number)

The required number argument is a Double or any valid numeric expression.

Remarks

If the value of number exceeds 709.782712893, an error occurs.  The constant e is approximately 2.718282.

Note   The Exp function complements the action of the Log function and is sometimes referred to as the antilogarithm.


Exp function example

This example returns e.

Exp(1)


Int, Fix functions

Returns a value of the type passed to it containing the integer portion of a number.

Syntax

Int(number)

Fix(number)

The required number argument is a Double or any valid numeric expression.  If number contains Null, Null is returned.

Remarks

Both Int and Fix remove the fractional part of number and return the resulting integer value.

The difference between Int and Fix is that if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number.  For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.

Fix(number) is equivalent to:

Sgn(number) * Int(Abs(number))


Int, Fix function examples

The following examples illustrate how the Int and Fix functions return integer portions of numbers.  In the case of a negative number argument, the Int function returns the first negative integer less than or equal to the number; the Fix function returns the first negative integer greater than or equal to the number.

Function	Returns
Int(99.8)	99
Fix(99.2)	99
Int(-99.8)	-100
Fix (-99.8)	-99
Int(-99.2)	-100
Fix(-99.2)	-99


Format function

Returns a Variant (String) containing an expression formatted according to instructions contained in a format expression.

Syntax

Format(expression[, format[, firstdayofweek[, firstweekofyear]]])

The Format function syntax has these parts:

Part	Description
expression	Required.  Any valid expression.
format	Optional.  A valid named or user-defined format expression.
firstdayofweek	Optional.  Specifies the first day of the week.
firstweekofyear	Optional.  Specifies the first week of the year.
Settings

The firstdayofweek argument has these settings:

Value	Description
0	Use NLS API setting.
1	Sunday (default)
2	Monday
3	Tuesday
4	Wednesday
5	Thursday
6	Friday
7	Saturday
The firstweekofyear argument has these settings:

Value	Description
0	Use NLS API setting.
1	Start with week in which January 1 occurs (default).
2	Start with the first week that has at least four days in the year.
3	Start with the first full week of the year.
Remarks

To Format	Do This
Numbers	Use predefined named numeric formats or create user-defined numeric formats.
Dates and times	Use predefined named date/time formats or create user-defined date/time formats.
Date and time serial numbers	Use date and time formats or numeric formats.
Strings	Create your own user-defined string formats.
If you try to format a number without specifying format, Format provides functionality similar to the Str function, although it is internationally aware.  However, positive numbers formatted as strings using Format don’t include a leading space reserved for the sign of the value; those converted using Str retain the leading space.


Named numeric formats (Format function)

The following table identifies the predefined numeric format names:

Format name	Description
General Number	Display number, with no thousand separator.
Currency	Display number with thousand separator, if appropriate; display two digits to the right of the decimal separator.  Output is based on system locale settings.
Fixed	Display at least one digit to the left and two digits to the right of the decimal separator.
Standard	Display number with thousand separator, at least one digit to the left and two digits to the right of the decimal separator.
Percent	Display number multiplied by 100 with a percent sign (%) appended to the right; always display two digits to the right of the decimal separator.
Scientific	Use standard scientific notation.
Yes/No	Display No if number is 0; otherwise, display Yes.
True/False	Display False if number is 0; otherwise, display True.
On/Off	Display Off if number is 0; otherwise, display On.


User-defined numeric formats (Format function)

The following table identifies characters you can use to create user-defined number formats:

Character	Description
None	No formatting
	Display the number with no formatting.
0	Digit placeholder
	Display a digit or a zero.  If the expression has a digit in the position where the 0 appears in the format string, display it; otherwise, display a zero in that position.
	If the number has fewer digits than there are zeros (on either side of the decimal) in the format expression, display leading or trailing zeros.  If the number has more digits to the right of the decimal separator than there are zeros to the right of the decimal separator in the format expression, round the number to as many decimal places as there are zeros.  If the number has more digits to the left of the decimal separator than there are zeros to the left of the decimal separator in the format expression, display the extra digits without modification.
#	Digit placeholder
	Display a digit or nothing.  If the expression has a digit in the position where the # appears in the format string, display it; otherwise, display nothing in that position.
	This symbol works like the 0 digit placeholder, except that leading and trailing zeros aren't displayed if the number has the same or fewer digits than there are # characters on either side of the decimal separator in the format expression.
.	Decimal placeholder
	In some locales, a comma is used as the decimal separator.  The decimal placeholder determines how many digits are displayed to the left and right of the decimal separator.  If the format expression contains only number signs to the left of this symbol, numbers smaller than 1 begin with a decimal separator.  To display a leading zero displayed with fractional numbers, use 0 as the first digit placeholder to the left of the decimal separator.  The actual character used as a decimal placeholder in the formatted output depends on the Number Format recognized by your system.
%	Percentage placeholder
	The expression is multiplied by 100.  The percent character (%) is inserted in the position where it appears in the format string.
,	Thousand separator
	In some locales, a period is used as a thousand separator.  The thousand separator separates thousands from hundreds within a number that has four or more places to the left of the decimal separator.  Standard use of the thousand separator is specified if the format contains a thousand separator surrounded by digit placeholders (0 or #).  Two adjacent thousand separators or a thousand separator immediately to the left of the decimal separator (whether or not a decimal is specified) means "scale the number by dividing it by 1000, rounding as needed."  For example, you can use the format string "##0,," to represent 100 million as 100.  Numbers smaller than 1 million are displayed as 0.  Two adjacent thousand separators in any position other than immediately to the left of the decimal separator are treated simply as specifying the use of a thousand separator.  The actual character used as the thousand separator in the formatted output depends on the Number Format recognized by your system.
:	Time separator
	In some locales, other characters may be used to represent the time separator.  The time separator separates hours, minutes, and seconds when time values are formatted.  The actual character used as the time separator in formatted output is determined by your system settings.
/	Date separator
	In some locales, other characters may be used to represent the date separator.  The date separator separates the day, month, and year when date values are formatted.  The actual character used as the date separator in formatted output is determined by your system settings.
E- E+ e- e+	Scientific format
	If the format expression contains at least one digit placeholder (0 or #) to the right of E-, E+, e-, or e+, the number is displayed in scientific format and E or e is inserted between the number and its exponent.  The number of digit placeholders to the right determines the number of digits in the exponent.  Use E- or e- to place a minus sign next to negative exponents.  Use E+ or e+ to place a minus sign next to negative exponents and a plus sign next to positive exponents.
- + $ ( ) space	Display a literal character
	To display a character other than one of those listed, precede it with a backslash (\) or enclose it in double quotation marks (" ").
\	Display the next character in the format string
	To display a character that has special meaning as a literal character, precede it with a backslash (\) .  The backslash itself isn't displayed.  Using a backslash is the same as enclosing the next character in double quotation marks.  To display a backslash, use two backslashes (\\).
	Examples of characters that can't be displayed as literal characters are the date-formatting and time-formatting characters (a, c, d, h, m, n, p, q, s, t, w, y, and /:), the numeric-formatting characters (#, 0, %, E, e, comma, and period), and the string-formatting characters (@, &, <, >, and !).
"ABC"	Display the string inside the double quotation marks
	To include a string in format from within the formula, you must use Chr(34) to enclose the text (34 is the character code for a double quotation mark (“ “)).


Different formats for different numeric values (Format function)

A user-defined format expression for numbers can have from one to four sections separated by semicolons.  (If the format argument contains one of the named numeric formats, only one section is allowed.)

If you use	The result is
One section only	The format expression applies to all values.
Two sections	The first section applies to positive values and zeros, the second to negative values.
Three sections	The first section applies to positive values, the second to negative values, and the third to zeros.
Four sections	The first section applies to positive values, the second to negative values, the third to zeros, and the fourth to Null values.
The following example has two sections: the first defines the format for positive values and zeros; the second section defines the format for negative values.

"$#,##0;($#,##0)"

If you include semicolons with nothing between them, the missing section is printed using the format of the positive value.  For example, the following format displays positive and negative values using the format in the first section and displays "Zero" if the value is zero.

"$#,##0;;\Z\e\r\o"


User-defined numeric format expressions

The following table contains some sample format expressions for numbers. (These examples all assume that your system's locale setting is English-U.S.)  The first column contains the format strings; the other columns contain the output that results if the formatted data has the value given in the column headings.

Format (format)	Positive 5	Negative 5	Decimal .5	Null
Zero-length string	5	-5	0.5
0	5	-5	1
0.00	5.00	-5.00	0.50
#,##0	5	-5	1
#,##0.00;;;Nil	5.00	-5.00	0.50	Nil
$#,##0;($#,##0)	$5	($5)	$1
$#,##0.00;($#,##0.00)	$5.00	($5.00)	$0.50
0%	500%	-500%	50%
0.00%	500.00%	-500.00%	50.00%
0.00E+00	5.00E+00	-5.00E+00	5.00E-01
0.00E-00	5.00E00	-5.00E00	5.00E-01


Named Date/Time formats (Format function)

The following table identifies the predefined date and time format names:

Format Name	Description
General Date	Display a date and/or time.  For real numbers, display a date and time (for example, 4/3/93 05:34 PM); if there is no fractional part, display only a date (for example, 4/3/93); if there is no integer part, display time only (for example, 05:34 PM).  Date display is determined by your system settings.
Long Date	Display a date according to your system's long date format.
Medium Date	Display a date using the medium date format appropriate for the language version of Outlook you use. For example, the English-U.S. version includes the day, month, and year (for example, 05-Jan-96).
Short Date	Display a date using your system's short date format.
Long Time	Display a time using your system's long time format: includes hours, minutes, seconds.
Medium Time	Display time in 12-hour format using hours and minutes and the AM/PM designator.
Short Time	Display a time using the 24-hour format (for example, 17:45).


User-defined Date/Time formats (Format function)

The following table identifies characters you can use to create user-defined date/time formats:

Character	Description
:	Time separator.  In some locales, other characters may be used to represent the time separator.  The time separator separates hours, minutes, and seconds when time values are formatted.  The actual character used as the time separator in formatted output is determined by your system settings.
/	Date separator.  In some locales, other characters may be used to represent the date separator.  The date separator separates the day, month, and year when date values are formatted.  The actual character used as the date separator in formatted output is determined by your system settings.
C	Display the date as ddddd and display the time as  t t t t t, in that order.  Display only date information if there is no fractional part to the date serial number; display only time information if there is no integer portion.
D	Display the day as a number without a leading zero (1 – 31).
Dd	Display the day as a number with a leading zero (01 – 31).
Ddd	Display the day as an abbreviation (Sun – Sat).
dddd	Display the day as a full name (Sunday – Saturday).
Ddddd	Display the date as a complete date (including day, month, and year), formatted according to your system's short date format setting.  For Microsoft Windows, the default short date format is m/d/yy.
dddddd	Display a date serial number as a complete date (including day, month, and year) formatted according to the long date setting recognized by your system.  For Microsoft Windows, the default long date format is mmmm dd, yyyy.
w	Display the day of the week as a number (1 for Sunday through 7 for Saturday).
ww	Display the week of the year as a number (1 – 53).
m	Display the month as a number without a leading zero (1 – 12).  If m immediately follows h or hh, the minute rather than the month is displayed.
mm	Display the month as a number with a leading zero (01 – 12).  If m immediately follows h or hh, the minute rather than the month is displayed.
mmm	Display the month as an abbreviation (Jan – Dec).
mmmm	Display the month as a full month name (January – December).
q	Display the quarter of the year as a number (1 – 4).
y	Display the day of the year as a number (1 – 366).
yy	Display the year as a 2-digit number (00 – 99).
yyyy	Display the year as a 4-digit number (100 – 9999).
h	Display the hour as a number without leading zeros (0 – 23).
hh	Display the hour as a number with leading zeros (00 – 23).
n	Display the minute as a number without leading zeros (0 – 59).
nn	Display the minute as a number with leading zeros (00 – 59).
s	Display the second as a number without leading zeros (0 – 59).
ss	Display the second as a number with leading zeros (00 – 59).
t t t t t	Display a time as a complete time (including hour, minute, and second), formatted using the time separator defined by the time format recognized by your system.  A leading zero is displayed if the leading zero option is selected and the time is before 10:00 A.M. or P.M.  The Microsoft Windows default time format is h:mm:ss.
AM/PM	Use the 12-hour clock and display an uppercase AM with any hour before noon; display an uppercase PM with any hour between noon and 11:59 P.M.
am/pm	Use the 12-hour clock and display a lowercase AM with any hour before noon; display a lowercase PM with any hour between noon and 11:59 P.M.
A/P	Use the 12-hour clock and display an uppercase A with any hour before noon; display an uppercase P with any hour between noon and 11:59 P.M.
a/p	Use the 12-hour clock and display a lowercase A with any hour before noon; display a lowercase P with any hour between noon and 11:59 P.M.
AMPM	Use the 12-hour clock and display the AM string literal as defined by your system with any hour before noon; display the PM string literal as defined by your system with any hour between noon and 11:59 P.M.  AMPM can be either uppercase or lowercase, but the case of the string displayed matches the string as defined by your system settings.  For Microsoft Windows, the default format is AM/PM.


User-defined Date/Time formats

The following are examples of user-defined date and time formats for December 7, 1958:

Format	Display
m/d/yy	12/7/58
d-mmm	7-Dec
d-mmmm-yy	7-December-58
d mmmm	7 December
mmmm yy	December 58
hh:mm AM/PM	08:50 PM
h:mm:ss a/p	8:50:35 p
h:mm	20:50
h:mm:ss	20:50:35
m/d/yy h:mm	12/7/58 20:50


User-defined String formats (Format function)

You can use any of the following characters to create a format expression for strings:

Character	Description
@	Character placeholder
	Display a character or a space.  If the string has a character in the position where the @ appears in the format string, display it; otherwise, display a space in that position.  Placeholders are filled from right to left unless there is an ! character in the format string.
&	Character placeholder
	Display a character or nothing.  If the string has a character in the position where the & appears, display it; otherwise, display nothing.  Placeholders are filled from right to left unless there is an ! character in the format string.
<	Force lowercase
	Display all characters in lowercase format.
>	Force uppercase
	Display all characters in uppercase format.
!	Force left to right fill of placeholders
	The default is to fill from right to left.


Different formats for different string values (Format function)

A format expression for strings can have one section, or two sections separated by a semicolon.

If you use	The result is
One section only	The format applies to all string data.
Two sections	The first section applies to string data, the second to Null values and zero-length strings (““).


Format function example

This example shows various uses of the Format function to format values by using both named and user-defined formats.  For the date separator (/), time separator (:), and AM/ PM literal, the actual formatted output displayed by your system depends on the locale settings on which the code is running.  When displayed in a field, the short time and short date formats of the system locale are used, which may differ from the code locale.  For these examples, English/United States is assumed.

Function	Returns
Format([Received], "h:m:s")	17:4:23
Format([Received], "Long Time")	17:4:23 PM
Format([Received], "Long Date")	Monday, January 27, 1997
Format([Received], "hh:mm:ss AMPM")	05:04:23 PM
Format([Received], "dddd, mmm d yyyy")	Monday, Jan 27 1997
Function	Returns
Format(23)	23
Format(5459.4, "##,##0.00")	5,459.40
Format(334.9, "###0.00")	334.90
Format(5, "0.00%")	500.00%
Format("HELLO", "<")	hello
Format("This is it", ">")	THIS IS IT


FV function

Returns a Double specifying the future value of an annuity based on periodic, constant payments and a constant interest rate.

Syntax

FV(rate, nper, pmt[, pv[, type]])

The FV function has these named arguments:

Part	Description
rate	Required.  Double specifying interest rate per period.  For example, if you get a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
nper	Required.  Integer specifying total number of payment periods in the annuity.  For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pmt	Required.  Double specifying payment to be made each period.  Payments usually contain principal and interest that doesn't change over the life of the annuity.
pv	Optional.  Variant specifying present value (or lump sum) of a series of future payments.  For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make. If omitted, 0 is assumed.
type	Optional.  Variant specifying when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Remarks

An annuity is a series of constant cash payments made over a period of time.  An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

The arguments rate and nper must be calculated using payment periods expressed in the same units.  For example, if rate is calculated using months, nper must also be calculated using months.

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


FV function example

This example uses the FV function to return the future value of an investment given the percentage rate that accrues per period (APR / 12), the total number of payments (TotPmts), the payment (Payment), the current value of the investment (PVal), and a number that indicates whether the payment is made at the beginning or end of the payment period (PayType).  Note that because Payment represents cash paid out, it's a negative number.

FV([APR] / 12, [TotPmts], -[Payment], -[PVal], [PayType])


Hex function

Returns a String representing the hexadecimal value of a number.

Syntax

Hex(number)

The required number argument is any valid numeric expression or string expression.

Remarks

If number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If number is	Hex returns
Null	Null.
Empty	Zero (0).
Any other number	Up to eight hexadecimal characters.
You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H.  For example, &H10 represents decimal 16 in hexadecimal notation.


Hex function example

The following examples use the Hex function to return the hexadecimal value of values for the Number field.

Number field	Function returns
5	5
10	A
459	1CB
Hex([Number])


Hour function

Returns a Variant (Integer) specifying a whole number between 0 and 23, inclusive, representing the hour of the day.

Syntax

Hour(time)

The required time argument is any Variant, numeric expression, string expression, or any combination, that can represent a time.  If time contains Null, Null is returned.


Hour function example

The following example uses the Hour function to return the hour of the Received field.

Hour([Received])


IIf function

Returns one of two parts, depending on the evaluation of an expression.

Syntax

IIf(expr, truepart, falsepart)

The IIf function syntax has these named arguments:

Part	Description
expr	Required.  Expression you want to evaluate.
truepart	Required.  Value or expression returned if expr is True.
falsepart	Required.  Value or expression returned if expr is False.
Remarks

IIf always evaluates both truepart and falsepart, even though it returns only one of them.  Because of this, you should watch for undesirable side effects.  For example, if evaluating falsepart results in a division by zero error, an error occurs even if expr is True.


IIf function example

The following example uses the IIf function to return the word "Large" if the value of the Size field is greater than 10000; otherwise, it returns the word "Small".

IIf([Size] > 10000, "Large", "Small")


InStr function

Returns a Variant (Long) specifying the position of the first occurrence of one string within another.

Syntax

InStr([start, ]string1, string2[, compare])

The InStr function syntax has these named arguments:

Part	Description
start	Optional.  Numeric expression that sets the starting position for each search.  If omitted, search begins at the first character position.  If start contains Null, an error occurs.  The start argument is required if compare is specified.
string1	Required.  String expression being searched.
string2	Required.  String expression sought.
compare	Optional.  Specifies the type of string comparison.  The compare argument can be omitted, or it can be 0 or 1.  Specify 0 (default) to perform a binary comparison.  Specify 1 to perform a textual, case-insensitive comparison.  If compare is Null, an error occurs.  If compare is omitted, the comparison method is binary.
Return Values

If	InStr returns
string1 is zero-length	0
string1 is Null	Null
string2 is zero-length	start
string2 is Null	Null
string2 is not found	0
string2 is found within string1	Position at which match is found
start > string2	0


InStr function example

The following example uses the InStr function to return the position of the first occurrence of the letter S within the Subject field.

Subject field	Function returns
International Sales	11
Marketing Strategy	15
InStr(1, [Subject], "S", 1)


IPmt function

Returns a Double specifying the interest payment for a given period of an annuity based on periodic, constant payments and a constant interest rate.

Syntax

IPmt(rate, per, nper, pv[, fv[, type]])

The IPmt function has these named arguments:

Part	Description
rate	Required.  Double specifying interest rate per period.  For example, if you get a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
per	Required.  Double specifying payment period in the range 1 through nper.
nper	Required.  Double specifying total number of payment periods in the annuity.  For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pv	Required.  Double specifying present value, or value today, of a series of future payments or receipts.  For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make.
fv	Optional.  Variant specifying future value or cash balance you want after you've made the final payment.  For example, the future value of a loan is $0 because that's its value after the final payment.  However, if you want to save $50,000 over 18 years for your child's education , then $50,000 is the future value. If omitted, 0 is assumed.
type	Optional.  Variant specifying when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Remarks

An annuity is a series of constant cash payments made over a period of time.  An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

The arguments rate and nper must be calculated using payment periods expressed in the same units.  For example, if rate is calculated using months, nper must also be calculated using months.

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


IPmt function example

This example uses the IPmt function to calculate how much of a payment is interest when all the payments are of equal value.  Given are the interest percentage rate per period (APR / 12), the payment period for which the interest portion is desired (Period), the total number of payments (TotPmts), the present value or principal of the loan (PVal), the future value of the loan (FVal), and a number that indicates whether the payment is due at the beginning or end of the payment period (PayType).

IPmt([APR] / 12, [Period], [TotPmts], -[PVal], [FVal], [PayType])


IsDate function

Returns a Boolean value indicating whether an expression can be converted to a date.

Syntax

IsDate(expression)

The required expression argument is a Variant  containing a date expression or string expression recognizable as a date or time.

Remarks

IsDate returns True if the expression is a date or can be converted to a valid date; otherwise, it returns False.  In Microsoft Windows, the range of valid dates is January 1, 100 A.D. through December 31, 9999 A.D.; the ranges vary among operating systems.

Unlike a Date/Time field in Outlook, text descriptions such as "next Thursday" are not recognized as valid expressions for the IsDate function.


IsDate function example

The following example uses the IsDate function to determine whether the Other field can be converted to a date.

IsDate([Other])


LCase function

Returns a String that has been converted to lowercase.

Syntax

LCase(string)

The required string argument is any valid string expression.  If string contains Null, Null is returned.

Remarks

Only uppercase letters are converted to lowercase; all lowercase letters and nonletter characters remain unchanged.


LCase function example

The following example returns lowercase values of the Subject field.

Subject field	Function returns
International Sales	international sales
Marketing Strategy	marketing strategy
LCase([Subject])


Left function

Returns a Variant (String) containing a specified number of characters from the left side of a string.

Syntax

Left(string, length)

The Left function syntax has these named arguments:

Part	Description
string	Required.  String expression from which the leftmost characters are returned.  If string contains Null, Null is returned.
length	Required; Variant (Long).  Numeric expression indicating how many characters to return.  If 0, a zero-length string (““) is returned.  If greater than or equal to the number of characters in string, the entire string is returned.
Remarks

To determine the number of characters in string, use the Len function.


Left function example

The following example returns four characters from the left side of the Subject field.

Subject field	Function returns
International Sales	Inte
Marketing Strategy	Mark
Left([Subject], 4)


Len function

Returns a Long containing the number of characters in a string.

Syntax

Len(string)

The Len function syntax has these parts:

Part	Description
string	Any valid String expression.  If string contains Null, Null is returned.


Len function example

The following example uses the Len function to return the number of characters in the Subject field.

Subject field	Function returns
International Sales	19
Marketing Strategy	18
Len([Subject])


Log function

Returns a Double specifying the natural logarithm of a number.

Syntax

Log(number)

The required number argument is a Double or any valid numeric expression greater than zero.

Remarks

The natural logarithm is the logarithm to the base e.  E is approximately 2.718282.

You can calculate base-n logarithms for any number x by dividing the natural logarithm of x by the natural logarithm of n as follows:

Logn(x) = Log(x) / Log(n)

The following example illustrates a formula field that calculates base-10 logarithms for a number field X:

Log([X]) / Log(10)


Log function example

The following example returns the natural logarithm for the numeric field Angle.

Log([Angle] + Sqr([Angle] * [Angle] + 1))


LTrim, RTrim, and Trim functions

Returns a Variant (String) containing a copy of a specified string without leading spaces (LTrim), trailing spaces (RTrim), or both leading and trailing spaces (Trim).

Syntax

LTrim(string)

RTrim(string)

Trim(string)

The required string argument is any valid String expression.  If string contains Null, Null is returned.


LTrim, RTrim, and Trim function examples

The following examples use the LTrim and RTrim functions to strip leading and trailing spaces, respectively, from a Subject field that contains the value " <-Trim-> ".  It uses the Trim function alone to strip both types of spaces. The quotation marks mark the end of the string but are not part of it.

Function	Returns
LTrim([Subject])	"<-Trim-> "
RTrim([Subject])	" <-Trim->"
Trim([Subject])	"<-Trim->"


Mid function

Returns a Variant (String) containing a specified number of characters from a string.

Syntax

Mid(string, start[, length])

The Mid function syntax has these named arguments:

Part	Description
string	Required.  String expression from which characters are returned.  If string contains Null, Null is returned.
start	Required; Long.  Character position in string at which the part to be taken begins.  If start is greater than the number of characters in string, Mid returns a zero-length string (““).
Length	Optional; Variant (Long).  Number of characters to return.  If omitted or if there are fewer than length characters in the text (including the character at start), all characters from the start position to the end of the string are returned.
Remarks

To determine the number of characters in string, use the Len function.


Mid function example

The following example uses the Mid function to return a specified number of characters from the Subject field with the value "Marketing Strategy".

Function	Returns
Mid ([Subject], 1, 3)	Mar
Mid ([Subject], 11, 8)	Strategy
Mid ([Subject], 5)	eting Strategy


Minute function

Returns a Variant (Integer) specifying a whole number between 0 and 59, inclusive, representing the minute of the hour.

Syntax

Minute(time)

The required time argument is any Variant, numeric expression, string expression, or any combination, that can represent a time.  If time contains Null, Null is returned.


Minute function example

The following example uses the Minute function to return the minute of the Received field.

Minute([Received])


Month function

Returns a Variant (Integer) specifying a whole number between 1 and 12, inclusive, representing the month of the year.

Syntax

Month(date)

The required date argument is any Variant, numeric expression, string expression, or any combination, that can represent a date.  If date contains Null, Null is returned.


Month function example

The following example uses the Month function to return the month of the Received field.

Month([Received])


Now function

Returns a Variant (Date) specifying the current date and time according your computer's system date and time.

Syntax

Now( )


Now function example

The following example uses the Now function to return the number of days since an item was received.

DateValue(Now())-DateValue([Received]) & " Day(s)"


NPer function

Returns a Double specifying the number of periods for an annuity based on periodic, constant payments and a constant interest rate.

Syntax

NPer(rate, pmt, pv[, fv[, type]])

The NPer function has these named arguments:

Part	Description
rate	Required.  Double specifying interest rate per period.  For example, if you get a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
pmt	Required.  Double specifying payment to be made each period.  Payments usually contain principal and interest that doesn't change over the life of the annuity.
pv	Required.  Double specifying present value, or value today, of a series of future payments or receipts.  For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make.
fv	Optional.  Variant specifying future value or cash balance you want after you've made the final payment. For example, the future value of a loan is $0 because that's its value after the final payment.  However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed.
type	Optional.  Variant specifying when payments are due.  Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Remarks

An annuity is a series of constant cash payments made over a period of time.  An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


NPer function example

This example uses the NPer function to return the number of periods over which payments must be made to pay off a loan whose value is contained in PVal.  Also provided are the interest percentage rate per period (APR / 12), the payment (Payment), the future value of the loan (FVal), and a number that indicates whether the payment is due at the beginning or end of the payment period (PayType).

IPmt([APR] / 12, [Period], [TotPmts], -[PVal], [FVal], [PayType])


Oct function

Returns a Variant (String) representing the octal value of a number.

Syntax

Oct(number)

The required number argument is any valid numeric expression or String expression.

Remarks

If number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If number is	Oct returns
Null	Null.
Empty	Zero (0).
Any other number	Up to 11 octal characters.
You can represent octal numbers directly by preceding numbers in the proper range with &O.  For example, &O10 is the octal notation for decimal 8.


Oct function example

The following examples use the Oct function to return the octal value of values for the Number field.

Number field	Function returns
4	4
8	10
459	713
Oct([Number])


Pmt function

Returns a Double specifying the payment for an annuity based on periodic, constant payments and a constant interest rate.

Syntax

Pmt(rate, nper, pv[, fv[, type]])

The Pmt function has these named arguments:

Part	Description
rate	Required.  Double specifying interest rate per period.  For example, if you get a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
nper	Required.  Integer specifying total number of payment periods in the annuity.  For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pv	Required.  Double specifying present value (or lump sum) that a series of payments to be paid in the future is worth now.  For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make.
fv	Optional.  Variant specifying future value or cash balance you want after you've made the final payment. For example, the future value of a loan is $0 because that's its value after the final payment.  However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed.
type	Optional.  Variant specifying when payments are due.  Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Remarks

An annuity is a series of constant cash payments made over a period of time.  An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

The arguments rate and nper must be calculated using payment periods expressed in the same units.  For example, if rate is calculated using months, nper must also be calculated using months.

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


Pmt function example

This example uses the Pmt function to return the payment for a loan over a fixed period.  Given are the interest percentage rate per period (APR / 12), the total number of payments (TotPmts), the present value or principal of the loan (PVal), the future value of the loan (FVal), and a number that indicates whether the payment is due at the beginning or end of the payment period (PayType).

Pmt([APR] / 12, [TotPmts], -[PVal], [FVal], [PayType])


PPmt function

Returns a Double specifying the principal payment for a given period of an annuity based on periodic, constant payments and a constant interest rate.

Syntax

PPmt(rate, per, nper, pv[, fv[, type]])

The PPmt function has these named arguments:

Part	Description
rate	Required.  Double specifying interest rate per period.  For example, if you get a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
per	Required.  Integer specifying payment period in the range 1 through nper.
nper	Required.  Integer specifying total number of payment periods in the annuity.  For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pv	Required.  Double specifying present value, or value today, of a series of future payments or receipts.  For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make.
fv	Optional.  Variant specifying future value or cash balance you want after you've made the final payment. For example, the future value of a loan is $0 because that's its value after the final payment.  However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed.
type	Optional.  Variant specifying when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Remarks

An annuity is a series of constant cash payments made over a period of time.  An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

The arguments rate and nper must be calculated using payment periods expressed in the same units.  For example, if rate is calculated using months, nper must also be calculated using months.

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


PPmt function example

This example uses the PPmt function to calculate how much of a payment for a specific period is principal when all the payments are of equal value.  Given are the interest percentage rate per period (APR / 12), the payment period for which the principal portion is desired (Period), the total number of payments (TotPmts), the present value or principal of the loan (PVal), the future value of the loan (FVal), and a number that indicates whether the payment is due at the beginning or end of the payment period (PayType).

PPmt([APR] / 12, [Period], [TotPmts], -[PVal], [FVal], [PayType])


PV function

Returns a Double specifying the present value of an annuity based on periodic, constant payments to be paid in the future and a constant interest rate.

Syntax

PV(rate, nper, pmt[, fv[, type]])

The PV function has these named arguments:

Part	Description
rate	Required.  Double specifying interest rate per period.  For example, if you get a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
nper	Required.  Integer specifying total number of payment periods in the annuity.  For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pmt	Required.  Double specifying payment to be made each period.  Payments usually contain principal and interest that doesn't change over the life of the annuity.
fv	Optional.  Variant specifying future value or cash balance you want after you've made the final payment. For example, the future value of a loan is $0 because that's its value after the final payment.  However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed.
type	Optional.  Variant specifying when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Remarks

An annuity is a series of constant cash payments made over a period of time.  An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

The arguments rate and nper must be calculated using payment periods expressed in the same units.  For example, if rate is calculated using months, nper must also be calculated using months.

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


PV function example

In this example, the PV function returns the present value of an annuity given the expected annual percentage rate (APR), the total number of payments (TotPmts), the amount of each payment (YrIncome), the total future value of the investment (FVal), and a number that indicates whether each payment is made at the beginning or end of the payment period (PayType).  Note that because YrIncome represents cash paid out from the annuity each year, it's a negative number.

PV([APR], [TotPmts], -[YrIncome], [FVal], [PayType])


Rate function

Returns a Double specifying the interest rate per period for an annuity.

Syntax

Rate(nper, pmt, pv[, fv[, type[, guess]]])

The Rate function has these named arguments:

Part	Description
nper	Required.  Double specifying total number of payment periods in the annuity.  For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pmt	Required.  Double specifying payment to be made each period.  Payments usually contain principal and interest that doesn't change over the life of the annuity.
pv	Required.  Double specifying present value, or value today, of a series of future payments or receipts.  For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make.
fv	Optional.  Variant specifying future value or cash balance you want after you've made the final payment. For example, the future value of a loan is $0 because that's its value after the final payment.  However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed.
type	Optional.  Variant specifying Number indicating when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
guess	Optional.  Variant specifying value you estimate will be returned by Rate. If omitted, guess is 0.1 (10 percent).
Remarks

An annuity is a series of constant cash payments made over a period of time.  An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.

Rate is calculated by iteration.  Starting with the value of guess, Rate cycles through the calculation until the result is accurate to within 0.00001 percent.  If Rate can't find a result after 20 tries, it fails.  If your guess is 10 percent and Rate fails, try a different value for guess.


Rate function example

This example uses the Rate function to calculate the interest rate of a loan given the total number of payments (TotPmts), the amount of the loan payment (Payment), the present value or principal of the loan (PVal), the future value of the loan (FVal), a number that indicates whether the payment is due at the beginning or end of the payment period (PayType), and an approximation of the expected interest rate (Guess).

(Rate([TotPmts], -[Payment], [PVal], [FVal], [PayType], [Guess]) * 12) * 100


Right function

Returns a Variant (String) containing a specified number of characters from the right side of a string.

Syntax

Right(string, length)

The Right function syntax has these named arguments:

Part	Description
string	Required.  String expression from which the rightmost characters are returned.  If string contains Null, Null is returned.
length	Required; Variant (Long) .  Numeric expression indicating how many characters to return.  If 0, a zero-length string ("") is returned.  If greater than or equal to the number of characters in string, the entire string is returned.
Remarks

To determine the number of characters in string, use the Len function.


Right function example

The following example returns four characters from the right side of the Subject field.

Subject field	Function returns
International Sales	ales
Marketing Strategy	tegy
Right([Subject], 4)


Rnd function

Returns a Single containing a random number.

Syntax

Rnd[(number)]

The optional number argument is a Single or any valid numeric expression.

Return Values

If number is	Rnd generates
Less than zero	The same number every time, using number as the seed.
Greater than zero	The next random number in the sequence.
Equal to zero	The most recently generated number.
Not supplied	The next random number in the sequence.
Remarks

The Rnd function returns a value less than 1 but greater than or equal to zero.

The value of number determines how Rnd generates a random number:

For any given initial seed, the same number sequence is generated because each successive call to the Rnd function uses the previous number as a seed for the next number in the sequence.

To produce random integers in a given range, use this formula:

Int(([upperbound] - [lowerbound] + 1) * Rnd + [lowerbound])

Here, upperbound is a field with the highest number in the range, and lowerbound is a field with the lowest number in the range.


Rnd function example

The following example uses the Rnd function to display a field with a random integer value from 1 to 6.

Int((6 * Rnd) + 1)


Second function

Returns a Variant (Integer) specifying a whole number between 0 and 59, inclusive, representing the second of the minute.

Syntax

Second(time)

The required time argument is any Variant, numeric expression, string expression, or any combination, that can represent a time.  If time contains Null, Null is returned.


Second function example

The following example uses the Second function to return the second of the time of the Received field.

Second([Received])


Sgn function

Returns a Variant (Integer) indicating the sign of a number.

Syntax

Sgn(number)

The required number argument can be any valid numeric expression.

Return Values

If number is	Sgn returns
Greater than zero	1
Equal to zero	0
Less than zero	-1
Remarks

The sign of the number argument determines the return value of the Sgn function.


Sgn function example

The following example returns the following values for the Angle field.

Angle field	Function returns
30	1
-45	-1
Sgn([Angle])


Sin function

Returns a Double specifying the sine of an angle.

Syntax

Sin(number)

The required number argument is a Double or any valid numeric expression that expresses an angle in radians.

Remarks

The Sin function takes an angle and returns the ratio of two sides of a right triangle. The ratio is the length of the side opposite the angle divided by the length of the hypotenuse.

The result lies in the range -1 to 1.

To convert degrees to radians, multiply degrees by pi/180.  To convert radians to degrees, multiply radians by 180/pi.


Sin function example

The following example uses the Sin function to return the sine of the Angle field.

Sin([Angle])


SLN function

Returns a Double specifying the straight-line depreciation of an asset for a single period.

Syntax

SLN(cost, salvage, life)

The SLN function has these named arguments:

Part	Description
cost	Required.  Double specifying initial cost of the asset.
salvage	Required.  Double specifying value of the asset at the end of its useful life.
life	Required.  Double specifying length of the useful life of the asset.
Remarks

The period for which the depreciation is returned is expressed in the same unit of time as the useful life of the asset.  All arguments must be positive numbers.


SLN function example

This example uses the SLN function to return the straight-line depreciation of an asset for a single period given the asset's initial cost (InitCost), the salvage value at the end of the asset's useful life (SalvageVal), and the total life of the asset in years (LifeTime).

SLN([InitCost], [SalvageVal], [LifeTime])


Space function

Returns a Variant (String) consisting of the specified number of spaces.

Syntax

Space(number)

The required number argument is the number of spaces you want in the string.

Remarks

The Space function is useful for formatting output and clearing data in fixed-length strings.


Space function example

The following example uses the Space function to return 10 spaces between the values of the Sent and Received fields in a column.

[Sent] & Space(10) & [Received]


Sqr function

Returns a Double specifying the square root of a number.

Syntax

Sqr(number)

The required number argument is a Double or any valid numeric expression greater than or equal to zero.


Sqr function example

This example returns the following values for the Angle field.

Angle field	Function returns
4	2
23	4.795831523313
0	0
Sqr([Angle])


Str function

Returns a Variant (String) representation of a number.

Syntax

Str(number)

The required number argument is a Long containing any valid numeric expression.

Remarks

When numbers are converted to strings, a leading space is always reserved for the sign of number.  If number is positive, the returned string contains a leading space and the plus sign is implied.

Use the Format function to convert numeric values you want formatted as dates, times, or currency or in other user-defined formats.  Unlike Str, the Format function doesn't include a leading space for the sign of number.

Note   The Str function recognizes only the period (.) as a valid decimal separator.  When different decimal separators may be used (for example, in international applications), use CStr to convert a number to a string.


Str function example

The following example uses the Str function to return a string representation of the Number field.  When a number is converted to a string, a leading space is always reserved for its sign.

Number field	Function returns
459	" 459"
-459.65	"-459.65"
459.001	" 459.001"
Str([Number])


StrComp function

Returns a Variant (Integer) indicating the result of a string comparison.

Syntax

StrComp(string1, string2[, compare])

The StrComp function syntax has these named arguments:

Part	Description
string1	Required.  Any valid String expression.
string2	Required.  Any valid String expression.
compare	Optional.  Specifies the type of string comparison.  The compare argument can be omitted, or it can be 0 or 1.  Specify 0 (default) to perform a binary comparison.  Specify 1 to perform a textual comparison.  If compare is Null, an error occurs.  If compare is omitted, the comparison method is binary.
Return Values

If	StrComp returns
string1 is less than string2	-1
string1 is equal to string2	0
string1 is greater than string2	1
string1 or string2 is Null	Null


StrComp function example

The following example compares the value of the File As field with the value of a combination of the First Name and Last Name fields.

StrComp([File As], [Last Name] & ", " & [First Name], 1)


String function

Returns a Variant (String) containing a repeating character string of the length specified.

Syntax

String(number, character)

The String function syntax has these named arguments:

Part	Description
number	Required; Long.  Length of the returned string.  If number contains Null, Null is returned.
character	Required; Variant.  Character code specifying the character or string expression whose first character is used to build the return string.  If character contains Null, Null is returned.
Remarks

If you specify a number for character greater than 255, String converts the number to a valid character code using the formula:

character Mod 256


String function example

The following examples use the String function to return repeating character strings of the length specified.

Function	Returns
String(5, "*")	*****
String(5, 42)	*****
String(10, "ABC")	AAAAAAAAAA


Switch function

Evaluates a list of expressions and returns a Variant value or an expression associated with the first expression in the list that is True.

Syntax

Switch(expr-1, value-1[, expr-2, value-2 … [, expr-n, value-n]])

The Switch function syntax has these parts:

Part	Description
expr	Required.  Variant expression you want to evaluate.
value	Required.  Value or expression to be returned if the corresponding expression is True.
Remarks

The Switch function argument list consists of pairs of expressions and values.  The expressions are evaluated from left to right, and the value associated with the first expression to evaluate to True is returned. If the parts aren't properly paired, a run-time error occurs.  For example, if expr-1 is True, Switch returns value-1. If expr-1 is False, but expr-2 is True, Switch returns value-2, and so on.

Switch returns a Null value if:

•	None of the expressions is True.

•	The first True expression has a corresponding value that is Null.

Switch evaluates all of the expressions, even though it returns only one of them.  For this reason, you should watch for undesirable side effects.  For example, if the evaluation of any expression results in a division by zero error, an error occurs.


Switch function example

The following example uses the Switch function to return the name of a language that matches the name of the Business Address City field.

Business Address City field	Function returns
London	English
Paris	French
Switch([Business Address City] = "London",
"English", [Business Address City]= "Paris", "French")


SYD function

Returns a Double specifying the sum-of-years' digits depreciation of an asset for a specified period.

Syntax

SYD(cost, salvage, life, period)

The SYD function has these named arguments:

Part	Description
cost	Required.  Double specifying initial cost of the asset.
salvage	Required.  Double specifying value of the asset at the end of its useful life.
life	Required.  Double specifying length of the useful life of the asset.
period	Required.  Double specifying period for which asset depreciation is calculated.
Remarks

The arguments life and period must be expressed in the same units.  For example, if life is given in months, period must also be given in months.  All arguments must be positive numbers.


SYD function example

By using the sum-of-years digits method, this example illustrates the use of the SYD function to return the depreciation of an asset for a specified period given the asset's initial cost (InitCost), the salvage value at the end of the asset's useful life (SalvageVal), and the total life of the asset in years (LifeTime).  The period for which the depreciation is calculated is DepYear, also in years.

SYD([InitCost], [SalvageVal], [LifeTime], [DepYear])


Tan function

Returns a Double specifying the tangent of an angle.

Syntax

Tan(number)

The required number argument is a Double or any valid numeric expression that expresses an angle in radians.

Remarks

Tan takes an angle and returns the ratio of two sides of a right triangle. The ratio is the length of the side opposite the angle divided by the length of the side adjacent to the angle.

To convert degrees to radians, multiply degrees by pi/180.  To convert radians to degrees, multiply radians by 180/pi.


Tan function example

The following example uses the Tan function to return the tangent of the numeric field Angle.

Tan([Angle])


Time function

Returns a Variant (Date) indicating the current system time.

Syntax

Time( )


Time function example

The following example uses the Time function to return the current system time.

Time( )


Timer function

Returns a Single representing the number of seconds elapsed since midnight.

Syntax

Timer( )


Timer function example

The following example uses the Timer function to return the seconds elapsed since midnight.

Timer( )


TimeSerial function

Returns a Variant (Date) containing the time for a specific hour, minute, and second.

Syntax

TimeSerial(hour, minute, second)

The TimeSerial function syntax has these named arguments:

Part	Description
hour	Required; Variant (Integer).  Number between 0 (12:00 A.M.) and 23 (11:00 P.M.), inclusive, or a numeric expression.
minute	Required; Variant (Integer).  Any numeric expression.
second	Required; Variant (Integer).  Any numeric expression.
Remarks

To specify a time, such as 11:59:59, the range of numbers for each TimeSerial argument should be in the normal range for the unit; that is, 0 – 23 for hours and 0 – 59 for minutes and seconds.  However, you can also specify relative times for each argument using any numeric expression that represents some number of hours, minutes, or seconds before or after a certain time.  The following example uses expressions instead of absolute time numbers.  The TimeSerial function returns a time for 15 minutes before (-15) six hours before noon (12 - 6), or 5:45:00 A.M.

TimeSerial(12 - 6, -15, 0)

When any argument exceeds the normal range for that argument, it increments to the next larger unit as appropriate.  For example, if you specify 75 minutes, it is evaluated as one hour and 15 minutes.  If any single argument is outside the range -32,768 to 32,767, an error occurs.  If the time specified by the three arguments causes the date to fall outside the acceptable range of dates, an error occurs.


TimeSerial function example

The following example uses the TimeSerial function to return a time for the values specified in the Hour, Minute, and Second custom fields.

TimeSerial([Hour], [Minute], [Second])


TimeValue function

Returns a Variant (Date) containing the time.

Syntax

TimeValue(time)

The required time argument is normally a string expression representing a time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.), inclusive.  However, time can also be any expression that represents a time in that range.  If time contains Null, Null is returned.

Remarks

You can enter valid times using a 12- or 24-hour clock.  For example, "2:24PM" and "14:24" are both valid time arguments.

If the time argument contains date information, TimeValue doesn't return it.  However, if time includes invalid date information, an error occurs.


TimeValue function example

The following example uses the TimeValue function to return a string entered in the Other field as a time.

TimeValue([Other])


UCase function

Returns a Variant (String) containing the specified string, converted to uppercase.

Syntax

UCase(string)

The required string argument is any valid string expression.  If string contains Null, Null is returned.

Remarks

Only lowercase letters are converted to uppercase; all uppercase letters and nonletter characters remain unchanged.


UCase function example

The following example returns uppercase values of the Subject field.

Subject field	Function returns
International Sales	INTERNATIONAL SALES
Marketing Strategy	MARKETING STRATEGY
UCase([Subject])


Val function

Returns the numbers contained in a string as a numeric value of appropriate type.

Syntax

Val(string)

The required string argument is any valid string expression.

Remarks

The Val function stops reading the string at the first character it can't recognize as part of a number.  Symbols and characters that are often considered parts of numeric values, such as dollar signs and commas, are not recognized.  However, the function recognizes radix prefixes &O (for octal) and &H (for hexadecimal).  Blanks, tabs, and linefeeds are stripped from the argument.

The following returns the value 168:

Val("    16 8th Street N.")

In the example below, Val returns the decimal value -1 for the hexadecimal value shown:

Val("&HFFFF")

Note   The Val function recognizes only the period (.) as a valid decimal separator.  When a possibility exists that different decimal separators may be used (for example, in international applications), you should use CDbl instead to convert a string to a number.


Val function example

The following example uses the Val function to return the numbers contained in the field String.

String field	Function returns
"2457"	2457
"2 45 7"	2457
"24 and 57"	24
Val([String])


Weekday function

Returns a Variant (Integer) containing a whole number representing the day of the week.

Syntax

Weekday(date, [firstdayofweek])

The Weekday function syntax has these named arguments:

Part	Description
date	Required.  Variant, numeric expression, string expression, or any combination, that can represent a date.  If date contains Null, Null is returned.
Firstdayofweek	Optional.  Specifies the first day of the week.  If not specified, Sunday is assumed.
Settings

The firstdayofweek argument has these settings:

Value	Description
0	Use the NLS API setting.
1	Sunday (default)
2	Monday
3	Tuesday
4	Wednesday
5	Thursday
6	Friday
7	Saturday
Return Values

The Weekday function can return any of these values:

Value	Description
1	Sunday
2	Monday
3	Tuesday
4	Wednesday
5	Thursday
6	Friday
7	Saturday


Weekday function example

The following example uses the Weekday function to obtain the day of the week from the Received field.

Weekday([Received])


Year function

Returns a Variant (Integer) containing a whole number representing the year.

Syntax

Year(date)

The required date argument is any Variant, numeric expression, string expression, or any combination, that can represent a date.  If date contains Null, Null is returned.


Year function example

The following example uses the Year function to return the year of the Received field.

Year([Received])


Derived math functions

The following is a list of nonintrinsic math functions that can be derived from the intrinsic math functions:

Function	Derived equivalents
Secant	Sec([X]) = 1 / Cos([X])
Cosecant	Cosec([X]) = 1 / Sin([X])
Cotangent	Cotan([X]) = 1 / Tan([X])
Inverse Sine	Arcsin([X]) = Atn([X] / Sqr(-[X] * [X] + 1))
Inverse Cosine	Arccos([X]) = Atn(-[X] / Sqr(-[X] * [X] + 1)) + 2 * Atn(1)
Inverse Secant	Arcsec([X]) = Atn([X] / Sqr([X] * [X] - 1)) + Sgn(([X]) - 1) * (2 * Atn(1))
Inverse Cosecant	Arccosec([X]) = Atn([X] / Sqr([X] * [X] - 1)) + (Sgn([X]) - 1) * (2 * Atn(1))
Inverse Cotangent	Arccotan([X]) = Atn([X]) + 2 * Atn(1)
Hyperbolic Sine	HSin([X]) = (Exp([X]) - Exp(-[X])) / 2
Hyperbolic Cosine	HCos([X]) = (Exp([X]) + Exp(-[X])) / 2
Hyperbolic Tangent	HTan([X]) = (Exp([X]) - Exp(-[X])) / (Exp([X]) + Exp(-[X]))
Hyperbolic Secant	HSec([X]) = 2 / (Exp([X]) + Exp(-[X]))
Hyperbolic Cosecant	HCosec([X]) = 2 / (Exp([X]) - Exp(-[X]))
Hyperbolic Cotangent	HCotan([X]) = (Exp([X]) + Exp(-[X])) / (Exp([X]) - Exp(-[X]))
Inverse Hyperbolic Sine	HArcsin([X]) = Log([X] + Sqr([X] * [X] + 1))
Inverse Hyperbolic Cosine	HArccos([X]) = Log([X] + Sqr([X] * [X] - 1))
Inverse Hyperbolic Tangent	HArctan([X]) = Log((1 + [X]) / (1 - [X])) / 2
Inverse Hyperbolic Secant	HArcsec([X]) = Log((Sqr(-[X] * [X] + 1) + 1) / [X])
Inverse Hyperbolic Cosecant	HArccosec([X]) = Log((Sgn([X]) * Sqr([X] * [X] + 1) + 1) / [X])
Inverse Hyperbolic Cotangent	HArccotan([X]) = Log(([X] + 1) / ([X] - 1)) / 2
Logarithm to base N	LogN([X]) = Log([X]) / Log(N)


Returning strings from functions

Some functions have two versions, one that returns a Variant data type and one that returns a String data type.  The variant versions tend to be the most convenient because variants handle conversions between different types of data automatically.

Consider using the String type version when:

•	Your program is very large and uses many variables.

•	You want to detect when data of one type is converted to another type.

•	You write data directly to random-access files.

The following functions return values in a String type variable when you append a dollar sign ($) to the function name.  These functions have the same usage and syntax as their variant equivalents without the dollar sign.

Chr$	Date$	Format$	Hex$
LCase$	Left$	Mid$	Oct$
Right$	RTrim$	Space$	Str$
String$	Time$	Trim$	UCase$


Type conversion functions

Each function coerces an expression to a specific data type.

Syntax

CCur(expression)

CDate(expression)

CDbl(expression)

CInt(expression)

CLng(expression)

CSng(expression)

CVar(expression)

CStr(expression)

The required argument expression is any String expression or numeric expression.

Remarks

The function name determines the return type as shown in the following:

Function	Return Type	Range for expression argument
CCur	Currency	-922,337,203,685,477.5808 to 922,337,203,685,477.5807.
CDate	Date	Any valid date expression
CDbl	Double	-1.79769313486232E308 to  -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values.
CInt	Integer	-32,768 to 32,767; fractions are rounded.
CLng	Long	-2,147,483,648 to 2,147,483,647; fractions are rounded.
CSng	Single	-3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values.
CVar	Variant	Same range as Double for numerics.  Same range as String for non-numerics.
CStr	String	Returns for CStr depend on the expression argument  (as explained below).

If the expression passed to the function is outside the range of the type being converted to, an error occurs.

In general, you can document your code using the data-type conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type.  For example, use CCur to force currency arithmetic in cases where single-precision, double-precision, or integer arithmetic normally would occur.

You should use the data-type conversion functions instead of Val to provide internationally-aware conversions from one data type to another.  For example, when you use CCur, different decimal separators are properly recognized depending on the locale setting of your computer, as are different thousand separators and various currency options.

CInt and CLng differ from the Fix and Int functions, which truncate, rather than round, the fractional part of a number.  When the fractional part is exactly 0.5, CInt and CLng always round it to the nearest even number.  For example, 0.5 rounds to 0, and 1.5 rounds to 2.  Also, Fix and Int always return a value of the same type as is passed in.

Use the IsDate function to determine if date can be converted to a date or time.  CDate recognizes date and time literals as well as some numbers that fall within the range of acceptable dates.  When converting a number to a date, the whole number portion is converted to a date.  Any fractional part of the number is converted to a time of day, starting at midnight.

CDate recognizes date formats according to the locale setting of your system.  The correct order of day, month, and year may not be determined if it is provided in a format other than one of the recognized date settings.  In addition, a long date format is not recognized if it also contains the day-of-the-week string.


Returns for CStr

If expression is	CStr returns
Date	A String containing a date in the short-date format of your system.
Null	A run-time error.
Empty	A zero-length String ("").
Error	A String containing the word Error followed by the error number.
Other numeric	A String containing the number.


Rounding

CInt and CLng differ from the Fix and Int functions, which truncate, rather than round, the fractional part of a number.  When the fractional part is exactly 0.5, CInt and CLng always round it to the nearest even number.  For example, 0.5 rounds to 0, and 1.5 rounds to 2..  Also, Fix and Int always return a value of the same type as is passed in.


All functions

Conversion functions

Date/Time functions

Financial functions

General functions

Math functions

Text functions


Math functions

Abs function

Atn function

Cos function

Exp function

Fix function

Int function

Log function

Rnd function

Sgn function

Sin function

Sqr function

Tan function

Derived math functions


Financial functions

DDB function

FV function

IPmt function

NPer function

Pmt function

PPmt function

PV function

Rate function

SLN function

SYD function


Text functions

Asc function

Chr function

Format function

InStr function

LCase function

Left function

Len function

LTrim function

Mid function

Right function

RTrim function

Space function

StrComp function

String function

Trim function

UCase function


General functions

Choose function

IIf function

Switch function


Date/Time functions

Date function

DateAdd function

DateDiff function

DatePart function

DateSerial function

DateValue function

Day function

Hour function

IsDate function

Minute function

Month function

Now function

Second function

Time function

Timer function

TimeSerial function

TimeValue function

Weekday function

Year function


Conversion functions

Asc function

CCur function

CDbl function

Chr function

CInt function

CLng function

CSng function

CStr function

CVar function

DateSerial function

DateValue function

Day function

Hex function

Hour function

Minute function

Month function

Oct function

Second function

Str function

TimeSerial function

TimeValue function

Val function

Weekday function

Year function


Bind controls to fields
Bind a control to a field

If you have created a control using the Control Toolbox and you would like the information in this control to be saved with the form, the control must be bound to a field on the form. This means that a link will be established between the control and the source of data, in this case, a field on the form.

1	In design mode, right-click the control you want to bind to a field and then click Properties on the shortcut menu.

2	On the Value tab, click Choose Field, point to a field set, and then click the field to which you want to bind the control. If you would like to bind the control to a new field that you created on the form, click  New. In the New Field box, type the name of your new field in the Name: area. Click OK in the New Field box.

3	Click OK in the Properties box.


Automatically calculate the result of a field

1	In design mode, right-click the control that is bound to the field whose properties you want to change, and then click Properties on the shortcut menu.

2	On the Value tab, select the Set the initial value of this field to check box.

3	In the box below enter the name of the field you want to use.

4	Click Calculate this formula automatically.

5	To make the control read-only, click the Display tab, and then select the Read only check box.


About the Message field

With the Message field, you can:

•	Insert file attachments or shortcuts. For example, for a Copier Request form, the Message field enables the user to attach files for copying. If the files are too large to send through the Microsoft Exchange system, the user can insert shortcuts to the attached files. In addition, the designer can insert files or shortcuts at design time. For example, you may want to insert attachments to Readme files that explain how to use the form or application.

•	Insert item attachments or shortcuts. By doing so, you can insert messages from other users in the Message field.

•	Insert a shortcut to a World Wide Web page. Recipients must have an Internet browser installed on their computers to insert shortcuts to Web pages.

•	Insert linked or embedded objects. These objects can be voice mails, Word documents, Microsoft Excel workbooks, and PowerPoint presentations.

Rules for using the Message field:

•	Each form can contain one Message control per page. For example, in a form, the Compose page can contain a Message control, and the Read page can contain a Message control.

•	You cannot have a Message control on the Message page and another page (for example, any of the pages with the label P.2 – P.6) of the Compose page or Read page.

•	If the form does not have the Separate Read Layout option selected for the page that contains the Message control, the form can only contain one Message control.

•	The Message control is automatically bound to the Message field.

•	The Message control is the only standard control on a form in which you or the user can insert files, items, or objects.


About Form Name and Message Class
About the form name and message class

The message class is an internal identifier used by Outlook and Microsoft Exchange to locate and activate a form.

The MessageClass property corresponds to the MAPI property PR_MESSAGE_CLASS. This class property determines which receiving folder the message should be routed to and which form should be activated to view the message.

If you type a name in the Display name box, in the Publish Form As dialog box, Outlook automatically constructs a message class for the form by preceding the form name with IPM. For instance, if you publish a mail message form that you want to name “MyForm”, in the Display name box, type: MyForm. At the bottom of the dialog box, Outlook will display the message class for your new form as: IPM.Note.MyForm.

A message class, which is generated automatically by Outlook from the form name, is assigned to the form. When a form with that message class is selected, Outlook loads and displays an instance of that form.


Accelerator Property

Sets or retrieves the accelerator key for a control.

Syntax

object.Accelerator [= String]

The Accelerator property syntax has these parts:

Part	Description
object	Required. A valid object.
String	Optional. The character to use as the accelerator key.
Remarks

To designate an accelerator key, enter a single character for the Accelerator property. You can set Accelerator in the control's property sheet or in code. If the value of this property contains more than one character, the first character in the string becomes the value of Accelerator.

When an accelerator key is used, there is no visual feedback (other than focus) to indicate that the control initiated the Click event. For example, if the accelerator key applies to a CommandButton, the user will not see the button pressed in the interface. The button receives the focus, however, when the user presses the accelerator key.


Alignment Property

Specifies the position of a control relative to its caption.

Syntax

object.Alignment [= 0,1]

The Alignment property syntax has these parts:

Part	Description
object	Required. A valid object.
Settings

The Settings for Alignment are:

Value	Description
0	Places the caption to the left of the control.
1	Places the caption  to the right of the control (default).
Remarks

The caption text for a control is left-aligned.


AutoSize Property

Specifies whether an object automatically resizes to display its entire contents.

Syntax

object.AutoSize [= Boolean]

The AutoSize property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the control is resized.
Settings

The settings for Boolean are:

Value	Description
True	Automatically resizes the control to display its entire contents.
False	Keeps the size of the control constant. Contents are clipped when they exceed the area of the control (default).
Remarks

For controls with captions, the AutoSize property specifies whether the control automatically adjusts to display the entire caption.

For controls without captions, this property specifies whether the control automatically adjusts to display the information stored in the control. In a ComboBox, for example, setting AutoSize to True automatically sets the width of the display area to match the length of the current text.

For a single-line TextBox, setting AutoSize to True automatically sets the width of the display area to the length of the text in the text box.

For a multiline TextBox that contains no text, setting AutoSize to True automatically displays the text as a column. The width of the text column is set to accommodate the widest letter of that font size. The height of the text column is set to display the entire text of the TextBox.

For a multiline TextBox that contains text, setting AutoSize to True automatically enlarges the TextBox vertically to display the entire text. The width of the TextBox does not change.

Note   If you manually change the size of a control while AutoSize is True, the manual change overrides the size previously set by AutoSize.


AutoTab Property

Specifies whether an automatic tab occurs when a user enters the maximum allowable number of characters into a TextBox or the text box portion of a ComboBox.

Syntax

object.AutoTab [= Boolean]

The AutoTab property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Specifies whether an automatic tab occurs.
Settings

The settings for Boolean are:

Value	Description
True	Tab occurs.
False	Tab does not occur (default).
Remarks

The MaxLength property specifies the maximum number of characters allowed in a TextBox or the text box portion of a ComboBox.

You can specify the AutoTab property for a TextBox or ComboBox on a form for which you usually enter a set number of characters. Once a user enters the maximum number of characters, the focus automatically moves to the next control in the tab order. For example, if a TextBox displays inventory stock numbers that are always five characters long, you can use MaxLength to specify the maximum number of characters to enter into the TextBox and AutoTab to automatically tab to the next control after the user enters five characters.


AutoWordSelect Property

Specifies whether the basic unit used to extend a selection is a word or a single character.

Syntax

object.AutoWordSelect [= Boolean]

The AutoWordSelect property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Specifies the basic unit used to extend a selection.
Settings

The settings for Boolean are:

Value	Description
True	Uses a word as the basic unit (default).
False	Uses a character as the basic unit.
Remarks

The AutoWordSelect property specifies how the selection extends or contracts in the edit region of a TextBox or ComboBox.

If the user places the insertion point in the middle of a word and then extends the selection while AutoWordSelect is True, the selection includes the entire word.


BackColor Property

Specifies the background color of the object.

Syntax

object.BackColor [= Long]

The BackColor property syntax has these parts:

Part	Description
object	Required. A valid object.
Long	Optional. A value or constant that determines the background color of an object.
Settings

You can use any integer that represents a valid color. You can also specify a color by using the RGB function with red, green, and blue color components. The value of each color component is an integer that ranges from zero to 255. For example, you can specify teal blue as the integer value 4966415 or as red, green, and blue color components 15, 200, 75.

Remarks

You can only see the background color of an object if the BackStyle property is set to 1.


BackStyle Property

Returns or sets the background style for an object.

Syntax

object.BackStyle [=BackStyle]

The BackStyle property syntax has these parts:

Part	Description
object	Required. A valid object.
BackStyle	Optional. Specifies the control background.
Settings

The settings for BackStyle are:

Value	Description
0	The background is transparent.
1	The background is opaque (default).
Remarks

The BackStyle property determines whether a control is transparent. If BackStyle is 1, the control is not transparent and you cannot see anything behind the control on a form. If BackStyle is 0, you can see through the control and look at anything on the form located behind the control. The BackColor property is only valid if the BackStyle property is set to 1.

Note  BackStyle does not affect the transparency of bitmaps. You must use a picture editor such as Paintbrush to make a bitmap transparent. Not all controls support transparent bitmaps.


Bold Property
Bold, Italic, Size, StrikeThrough, Underline, Weight Properties

Specifies the visual attributes of text on a displayed or printed form.

Syntax

object.Bold [= Boolean]

object.Italic [= Boolean]

object.Size [= Currency]

object.StrikeThrough [= Boolean]

object.Underline [= Boolean]

object.Weight [= Integer]

The Bold, Italic, Size, StrikeThrough, Underline, and Weight property syntaxes have these parts:

Part	Description
object	Required. A valid object name.
Boolean	Optional. Specifies the font style.
	Optional. A number indicating the font size.
Integer	Optional. Specifies the font style.
The settings for Boolean are:

Value	Description
True	The text has the specified attribute (that is bold, italic, size, strikethrough or underline marks, or weight).
False	The text does not have the specified attribute (default).
The Weight property accepts values from 0 to 1000. A value of zero allows the system to pick the most appropriate weight. A value from 1 to 1000 indicates a specific weight, where 1 represents the lightest type and 1000 represents the darkest type.

Remarks

These properties define the visual characteristics of text. The Bold property determines whether text is normal or bold. The Italic property determines whether text is normal or italic. The Size property determines the height, in points, of displayed text. The Underline property determines whether text is underlined. The StrikeThrough property determines whether the text appears with strikethrough marks. The Weight property determines the darkness of the type.

The font's appearance on screen and in print may differ, depending on your computer and printer. If you select a font that your system can't display with the specified attribute or that isn't installed, Windows substitutes a similar font. The substitute font will be as similar as possible to the font originally requested.

Changing the value of Bold also changes the value of Weight. Setting Bold to True sets Weight to 700; setting Bold to False sets Weight to 400. Conversely, setting Weight to anything over 550 sets Bold to True; setting Weight to 550 or less sets Bold to False.

The default point size is determined by the operating system.


BorderColor Property

Specifies the color of an object's border.

Syntax

object.BorderColor [= Long]

The BorderColor property syntax has these parts:

Part	Description
object	Required. A valid object.
Long	Optional. A value that determines the border color of an object.
Settings

You can use any integer that represents a valid color. You can also specify a color by using the RGB function with red, green, and blue color components. The value of each color component is an integer that ranges from zero to 255. For example, you can specify teal blue as the integer value 4966415 or as RGB color component values 15, 200, 75.

Remarks

To use the BorderColor property, the BorderStyle property must be set to a value other than 0.

BorderStyle uses BorderColor to define the border colors. The SpecialEffect property uses system colors exclusively to define its border colors. For Windows operating systems, system color settings are part of the Control Panel and are found in the Appearance tab of the Display folder. In Windows NT 3.51, system color settings are stored in the Color folder of the Control Panel.


BorderStyle Property

Specifies the type of border used by a control or a form.

Syntax

object.BorderStyle [=BorderStyle]

The BorderStyle property syntax has these parts:

Part	Description
object	Required. A valid object.
BorderStyle	Optional. Specifies the border style.
Settings

The settings for BorderStyle are:

Value	Description
0	The control has no visible border line.
1	The control has a single-line border (default).
The default value for a ComboBox, Frame, Label, ListBox or TextBox is 0 (None). The default value for an Image is 1 (Single).

Remarks

For a Frame, the BorderStyle property is ignored if the SpecialEffect property is None.

You can use either BorderStyle or SpecialEffect to specify the border for a control, but not both. If you specify a nonzero value for one of these properties, the system sets the value of the other property to zero. For example, if you set BorderStyle to 1, the system sets SpecialEffect to zero (Flat). If you specify a nonzero value for SpecialEffect, the system sets BorderStyle to zero.

BorderStyle uses BorderColor to define the colors of its borders. To use the BorderColor property, the BorderStyle property must be set to a value other than 0.


BoundColumn Property

Identifies the source of data in a multicolumn ComboBox or ListBox.

Syntax

object.BoundColumn [= Variant]

The BoundColumn property syntax has these parts:

Part	Description
object	Required. A valid object.
Variant	Optional. Indicates how the BoundColumn value is selected.
Settings

The settings for Variant are:

Value	Description
0	Assigns the value of the ListIndex property to the control.
1 or greater	Assigns the value from the specified column to the control. Columns are numbered from 1 when using this property (default).
Remarks

When the user chooses a row in a multicolumn ListBox or ComboBox, the BoundColumn property identifies which item from that row to store as the value of the control. For example, if each row contains 8 items and BoundColumn is 3, the system stores the information in the third column of the currently-selected row as the value of the object.

You can display one set of data to users but store different, associated values for the object by using the BoundColumn and the TextColumn properties. TextColumn identifies the column of data displayed in a ComboBox or ListBox; BoundColumn identifies the column of associated data values stored for the control. For example, you could set up a multicolumn ListBox that contains the names of holidays in one column and dates for the holidays in a second column. To present the holiday names to users, specify the first column as the TextColumn. To store the dates of the holidays, specify the second column as the BoundColumn.

If the control is bound to a data source, the value in the column specified by BoundColumn is stored in the data source named in the ControlSource property.

The ListIndex value retrieves the number of the selected row. For example, if you want to know the row of the selected item, set BoundColumn to 0 to assign the number of the selected row as the value of the control. Be sure to retrieve a current value, rather than relying on a previously saved value, if you are referencing a list whose contents might change.

The Column, List, and ListIndex properties all use zero-based numbering. That is, the value of the first item (column or row) is zero; the value of the second item is one, and so on. This means that if BoundColumn is set to 3, you could access the value stored in that column using the expression Column(2).


Cancel Property

Returns or sets a value indicating whether a CommandButton is the Cancel button on a form.

Syntax

object.Cancel [= Boolean]

The Cancel property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the object is the Cancel button.
Settings

The settings for Boolean are:

Value	Description
True	The CommandButton is the Cancel button.
False	The CommandButton is not the Cancel button (default).
Remarks

A CommandButton or an object that acts like a command button can be designated as the default command button. For OLE container controls, the Cancel property is provided only for those objects that specifically behave as command buttons.

Only one CommandButton on a form can be the Cancel button. Setting Cancel to True for one command button automatically sets it to False for all other objects on the form. When a CommandButton's Cancel property is set to True and the form is the active form, the user can choose the command button by clicking it, pressing ESC, or pressing ENTER when the button has the focus.

A typical use of Cancel is to give the user the option of canceling uncommitted changes and returning the form to its previous state.

You should consider making the Cancel button the default button for forms that support operations that can’t be undone (such as delete). To do this, set both Cancel and the Default property to True.


Caption Property

Descriptive text that appears on an object to identify or describe it.

Syntax

object.Caption [= String]

The Caption property syntax has these parts:

Part	Description
object	Required. A valid object.
String	Optional. A string expression that evaluates to the text displayed as the caption.
Settings

The default setting for a control is a unique name based on the type of control. For example, CommandButton1 is the default caption for the first command button in a form.

Remarks

The text identifies or describes the object with which it is associated. For buttons and labels, the Caption property specifies the text that appears in the control. For Page and Tab objects, it specifies the text that appears on the tab.

If a control's caption is too long, the caption is truncated. If a form's caption is too long for the title bar, the title is displayed with an ellipsis.

The ForeColor property of the control determines the color of the text in the caption.

Tip  If a control has both the Caption and AutoSize properties, setting AutoSize to True automatically adjusts the size of the control to frame the entire caption.


ClientHeight Property
ClientHeight, ClientLeft, ClientTop, ClientWidth Properties

Define the dimensions and location of the display area of a TabStrip.

Syntax

object.ClientHeight [ =Single]

object.ClientLeft [ =Single]

object.ClientTop [ =Single]

object.ClientWidth [ =Single]

The ClientHeight, ClientLeft, ClientTop, and ClientWidth property syntaxes have these parts:

Part	Description
object	Required. A valid object.
Single	Optional. For ClientHeight and ClientWidth, specifies the height or width, in points, of the display area. For ClientLeft and ClientTop, specifies the distance, in points, from the top or left edge of the TabStrip’s container.
Remarks

At run time, ClientLeft, ClientTop, ClientHeight, and ClientWidth automatically store the coordinates and dimensions of the TabStrip's internal area, which is shared by objects in the TabStrip.


Column Property

Specifies one or more items in a ListBox or ComboBox.

Syntax

object.Column( column, row ) [= Variant]

The Column property syntax has these parts:

Part	Description
object	Required. A valid object.
column	Optional. An integer with a range from 0 to one less than the total number of columns.
row	Optional. An integer with a range from 0 to one less than the total number of rows.
Variant	Optional. Specifies a single value, a column of values, or a two-dimensional array to load into a ListBox or ComboBox.
Settings

If you specify both the column and row values, Column reads or writes a specific item.

If you specify only the column value, the Column property reads or writes the specified column in the current row of the object. For example, MyListBox.Column (3) reads or writes the third column in MyListBox.

Column returns a Variant from the cursor. When a built-in cursor provides the value for Variant (such as when using the AddItem method), the value is a string. When an external cursor provides the value for Variant, formatting associated with the data is not included in the Variant.

Remarks

You can use Column to assign the contents of a combo box or list box to another control, such as a text box. For example, you can set the ControlSource property of a text box to the value in the second column of a list box.

If the user makes no selection when you refer to a column in a combo box or list box, the Column setting is Null. You can check for this condition by using the IsNull function.

You can also use Column to copy an entire two-dimensional array of values to a control. This syntax lets you quickly load a list of choices rather than individually loading each element of the list using AddItem.

Note  When copying data from a two-dimensional array, Column transposes the contents of the array in the control so that the contents of ListBox1.Column(X, Y) is the same as MyArray(Y, X). You can also use List to copy an array without transposing it.


ColumnCount Property

Specifies the number of columns to display in a list box or combo box.

Syntax

object.ColumnCount [= Long]

The ColumnCount property syntax has these parts:

Part	Description
object	Required. A valid object.
Long	Optional. Specifies the number of columns to display.
Remarks

If you set the ColumnCount property for a list box to 3 on an employee form, one column can list last names, another can list first names, and the third can list employee ID numbers.

Setting ColumnCount to 0 displays zero columns, and setting it to -1 displays all the available columns. For an unbound data source, there is a 10-column limit (0 to 9).

You can use the ColumnWidths property to set the width of the columns displayed in the control.


ColumnHeads Property

Displays a single row of column headings for list boxes, combo boxes, and objects that accept column headings.

Syntax

object.ColumnHeads [= Boolean]

The ColumnHeads property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Specifies whether the column headings are displayed.
Settings

The settings for Boolean are:

Value	Description
True	Display column headings.
False	Do not display column headings (default).
Headings in combo boxes appear only when the list drops down.

Remarks

When the system uses the first row of data items as column headings, they can't be selected.


ColumnWidths Property

Specifies the width of each column in a multicolumn ComboBox or ListBox.

Syntax

object.ColumnWidths [= String]

The ColumnWidths property syntax has these parts:

Part	Description
object	Required. A valid object.
String	Optional. Sets the column width in points. A setting of –1 or blank results in a calculated width. A width of 0 hides a column. To specify a different unit of measurement, include the unit of measure. A value greater than 0 explicitly specifies the width of the column.
Settings

To separate column entries, use semicolons (;) as list separators. Or use the list separator specified in the Regional Settings section of the Windows Control Panel.

Any or all of the ColumnWidths property settings can be blank. You create a blank setting by typing a list separator without a preceding value.

If you specify a –1 in the property page, the displayed value in the property page is a blank.

To calculate column widths when ColumnWidths is blank or –1, the width of the control is divided equally among all columns of the list. If the sum of the specified column widths exceeds the width of the control, the list is left-aligned within the control and one or more of the rightmost columns are not displayed. Users can scroll the list using the horizontal scroll bar to display the rightmost columns.

The minimum calculated column width is 72 points (1 inch). To produce columns narrower than this, you must specify the width explicitly.

Unless specified otherwise, column widths are measured in points. To specify another unit of measure, include the units as part of the values. The following examples specify column widths in several units of measure and describe how the various settings would fit in a three-column list box that is 4 inches wide.

Setting	Effect
90;72;90	The first column is 90 points (1.25 inch); the second column is 72 points (1 inch); the third column is 90 points.
6 cm;0;6 cm	The first column is 6 centimeters; the second column is hidden; the third column is 6 centimeters. Because part of the third column is visible, a horizontal scroll bar appears.
1.5 in;0;2.5 in	The first column is 1.5 inches, the second column is hidden, and the third column is 2.5 inches.
2 in;;2 in	The first column is 2 inches, the second column is 1 inch (default), and the third column is 2 inches. Because only half of the third column is visible, a horizontal scroll bar appears.
(Blank)	All three columns are the same width (1.33 inches).
Remarks

In a ComboBox, the system displays the column designated by the TextColumn property in the text box portion of the control. Setting TextColumn to –1 displays the first column that has a ColumnWidths value greater than 0.


ControlTipText Property

Specifies text that appears when the user briefly holds the mouse pointer over a control without clicking.

Syntax

object.ControlTipText [= String]

The ControlTipText property syntax has these parts:

Part	Description
object	Required. A valid object.
String	Optional. The text that appears when the user holds the mouse pointer over a control.
Remarks

The ControlTipText property lets you give users tips about a control in a running form. The property can be set during design time but only appears by the control during run time.

The default value of ControlTipText is an empty string. When the value of ControlTipText is set to an empty string, no tip is available for that control.


Count Property

Returns the number of objects in a collection.

Syntax

object.Count

The Count property syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

The Count property is read only.

Note that the index value for the first page or tab of a collection is zero, the value for the second page or tab is one, and so on. For example, if a MultiPage contains two pages, the indexes of the pages are 0 and 1, and the value of Count is 2.


CurTargetX Property

Retrieves the preferred horizontal position of the insertion point in a multiline TextBox or ComboBox.

Syntax

object.CurTargetX

The CurTargetX property syntax has these parts:

Part	Description
object	Required. A valid object.
Return Values

The CurTargetX property retrieves the preferred position, measured in himetric units. A himetric is 0.0001 meter.

Remarks

The target position is relative to the left edge of the control. If the length of a line is less than the value of the CurTargetX property, you can place the insertion point at the end of the line. The value of CurTargetX changes when the user sets the insertion point or when the CurX property is set. CurTargetX is read-only.

The return value is valid when the object has focus

You can use CurTargetX and CurX to move the insertion point as the user scrolls through the contents of a multiline TextBox or ComboBox. When the user moves the insertion point to another line of text by scrolling the content of the object, CurTargetX specifies the preferred position for the insertion point. CurX is set to this value if the line of text is longer than the value of CurTargetX. Otherwise, CurX is set to the end of the line of text.


CurX Property

Specifies the current horizontal position of the insertion point in a multiline TextBox or ComboBox.

Syntax

object.CurX [= Long]

The CurX property syntax has these parts:

Part	Description
object	Required. A valid object.
Long	Optional. Indicates the current position, measured in himetrics. A himetric is 0.0001 meter.
Remarks

The CurX property applies to a multiline TextBox or ComboBox. The return value is valid when the object has the focus

You can use CurTargetX and CurX to position the insertion point as the user scrolls through the contents of a multiline TextBox or ComboBox. When the user moves the insertion point to another line of text by scrolling the content of the object, CurTargetX specifies the preferred position for the insertion point. CurX is set to this value if the line of text is longer than the value of CurTargetX. Otherwise, CurX is set to the end of the line of text.


Cycle Property

Specifies the action to take when the user leaves the last control on a Frame or Page.

Syntax

object.Cycle [=Cycle]

The Cycle property syntax has these parts:

Part	Description
object	Required. A valid object.
Cycle	Optional. Specifies whether cycling includes controls nested in a Frame or MultiPage.
Settings

The settings for Cycle are:

Value	Description
0	Cycles through the controls on the form and the controls of the Frame and MultiPage controls that are currently displayed on the form.
2	Cycles through the controls on the form, Frame, or MultiPage. The focus stays within the form, Frame, or MultiPage until the focus is explicitly set to a control outside the form, Frame, or MultiPage.
If you specify a non-integer value for Cycle, the value is rounded up to the nearest integer.

Remarks

The tab order identifies the order in which controls receive the focus as the user tabs through a form or subform. The Cycle property determines the action to take when a user tabs from the last control in the tab order.

The 0 setting transfers the focus to the first control of the next Frame or MultiPage on the form when the user tabs from the last control in the tab order.

The 2 setting transfers the focus to the first control of the same form, Frame, or MultiPage when the user tabs from the last control in the tab order.


Default Property

Designates the default CommandButton on a form.

Syntax

object.Default [= Boolean]

The Default property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the command button is the default.
Settings

The settings for Boolean are:

Value	Description
True	The CommandButton is the default button.
False	The CommandButton is not the default button (default).
Remarks

A CommandButton or an object that acts like a command button can be designated as the default command button. Only one object on a form can be the default command button. Setting the Default property to True for one object automatically sets it to False for all other objects on the form.

To choose the default command button on an active form, the user can click the button, or press ENTER when no other CommandButton has the focus.

Default is provided for OLE container controls that specifically act like CommandButton controls.

Tip  You should consider making the Cancel button the default button for forms that support operations that can’t be undone (such as delete). To do this, set both Default and the Cancel property to True.


Delay Property

Specifies the delay on a SpinButton or ScrollBar.

Syntax

object.Delay [= Long]

The Delay property syntax has these parts:

Part	Description
object	Required. A valid object.
Long	Optional. The delay, in milliseconds, between events.
Remarks

The Delay property affects the amount of time between consecutive SpinUp, SpinDown, and Change events generated when the user clicks and holds down a button on a SpinButton or ScrollBar. The first event occurs immediately. The delay to the second occurrence of the event is five times the value of the specified Delay. This initial lag makes it easy to generate a single event rather than a stream of events.

After the initial lag, the interval between events is the value specified for Delay.

The default value of Delay is 50 milliseconds. This means the object initiates the first event after 250 milliseconds (5 times the specified value) and initiates each subsequent event after 50 milliseconds.


DragBehavior Property

Specifies whether the system enables the drag-and-drop feature for a TextBox or ComboBox.

Syntax

object.DragBehavior [=DragBehavior]

The DragBehavior property syntax has these parts:

Part	Description
object	Required. A valid object.
DragBehavior	Optional. Specifies whether the drag-and-drop feature is enabled.
Settings

The settings for DragBehavior are:

Value	Description
0	Does not allow a drag-and-drop action (default).
1	Allows a drag-and-drop action.
Remarks

If the DragBehavior property is enabled, dragging in a text box or combo box starts a drag-and-drop operation on the selected text. If DragBehavior is disabled, dragging in a text box or combo box selects text.

The drop-down portion of a ComboBox does not support drag-and-drop processes, nor does it support selection of list items within the text.

DragBehavior has no effect on a ComboBox whose Style property is set to 2.

Note  You can combine the effects of the EnterFieldBehavior property and DragBehavior to create a large number of text box styles.


DropButtonStyle Property

Specifies the symbol displayed on the drop button in a ComboBox.

Syntax

object.DropButtonStyle [=DropButtonStyle]

The DropButtonStyle property syntax has these parts:

Part	Description
object	Required. A valid object.
DropButtonStyle	Optional. The appearance of the drop button.
Settings

The settings for DropButtonStyle are:

Value	Description
0	Displays a plain button, with no symbol.
1	Displays a down arrow (default).
2	Displays an ellipsis ().
3	Displays a horizontal line like an underscore character.
Remarks

The recommended setting for showing items in a list is 1.


Enabled Property

Specifies whether a control can receive the focus and respond to user-generated events.

Syntax

object.Enabled [= Boolean]

The Enabled property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the object can respond to user-generated events.
Settings

The settings for Boolean are:

Value	Description
True	The control can receive the focus and respond to user-generated events, and is accessible through code (default).
False	The user cannot interact with the control by using the mouse, keystrokes, accelerators, or hotkeys. The control is generally still accessible through code.
Remarks

Use the Enabled property to enable and disable controls. A disabled control appears dimmed, while an enabled control does not. Also, if a control displays a bitmap, the bitmap is dimmed whenever the control is dimmed. If Enabled is False for an Image, the control does not initiate events but does not appear dimmed.

The Enabled and Locked properties work together to achieve the following effects:

•	If Enabled and Locked are both True, the control can receive focus and appears normally (not dimmed) in the form. The user can copy, but not edit, data in the control.

•	If Enabled is True and Locked is False, the control can receive focus and appears normally in the form. The user can copy and edit data in the control.

•	If Enabled is False and Locked is True, the control cannot receive focus and is dimmed in the form. The user can neither copy nor edit data in the control.

•	If Enabled and Locked are both False, the control cannot receive focus and is dimmed in the form. The user can neither copy nor edit data in the control.

You can combine the settings of the Enabled and the TabStop properties to prevent the user from selecting a command button with TAB, while still allowing the user to click the button. Setting TabStop to False means that the command button won't appear in the tab order. However, if Enabled is True, then the user can still click the command button, as long as TakeFocusOnClick is set to True.

When the user tabs into an enabled MultiPage or TabStrip, the first page or tab in the control receives the focus. If the first page or tab of a MultiPage or TabStrip is disabled, the first enabled page or tab of that control receives the focus. If all pages or tabs of a MultiPage or TabStrip are disabled, the control is disabled and cannot receive the focus.

If a Frame is disabled, all controls that it contains are disabled.

Clicking a disabled ListBox does not initiate the Click event.


EnterFieldBehavior Property

Specifies the selection behavior when entering a TextBox or ComboBox.

Syntax

object.EnterFieldBehavior [=EnterFieldBehavior]

The EnterFieldBehavior property syntax has these parts:

Part	Description
object	Required. A valid object.
EnterFieldBehavior	Optional. The desired selection behavior.
Settings

The settings for EnterFieldBehavior are:

Value	Description
0	Selects the entire contents of the edit region when entering the control (default).
1	Leaves the selection unchanged. Visually, this uses the selection that was in effect the last time the control was active.
Remarks

The EnterFieldBehavior property controls the way text is selected when the user tabs to the control, not when the control receives focus as a result of the SetFocus method. Following SetFocus, the contents of the control are not selected and the insertion point appears after the last character in the control’s edit region.

Note  You can combine the effects of the EnterFieldBehavior property and DragBehavior to create a large number of text box styles.


EnterKeyBehavior Property

Defines the effect of pressing ENTER in a TextBox.

Syntax

object.EnterKeyBehavior [= Boolean]

The EnterKeyBehavior property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Specifies the effect of pressing ENTER.
Settings

The settings for Boolean are:

Value	Description
True	Pressing ENTER creates a new line.
False	Pressing ENTER moves the focus to the next object in the tab order (default).
Remarks

The EnterKeyBehavior and MultiLine properties are closely related. The values described above only apply if MultiLine is True. If MultiLine is False, pressing ENTER always moves the focus to the next control in the tab order regardless of the value of EnterKeyBehavior.

The effect of pressing CTRL+ENTER also depends on the value of MultiLine. If MultiLine is True, pressing CTRL+ENTER creates a new line regardless of the value of EnterKeyBehavior. If MultiLine is False, pressing CTRL+ENTER has no effect.


ForeColor Property

Specifies the foreground color of an object.

Syntax

object.ForeColor [= Long]

The ForeColor property syntax has these parts:

Part	Description
object	Required. A valid object.
Long	Optional. A value or constant that determines the foreground color of an object.
Settings

You can use any integer that represents a valid color. You can also specify a color by using the RGB function with red, green, and blue color components. The value of each color component is an integer that ranges from zero to 255. For example, you can specify teal blue as the integer value 4966415 or as red, green, and blue color components 15, 200, 75.

Remarks

Use the ForeColor property for controls on forms to make them easy to read or to convey a special meaning. For example, if a text box reports the number of units in stock, you can change the color of the text when the value falls below the reorder level.

For a ScrollBar or SpinButton, ForeColor sets the color of the arrows. For a Frame, ForeColor changes the color of the caption. For a Font object, ForeColor determines the color of the text.


GroupName Property

Creates a group of mutually exclusive OptionButton controls.

Syntax

object.GroupName [= String]

The GroupName property syntax has these parts:

Part	Description
object	Required. A valid OptionButton.
String	Optional. The name of the group that includes the OptionButton. Use the same setting for all buttons in the group. The default setting is an empty string.
Remarks

To create a group of mutually exclusive OptionButton controls, you can put the buttons in a Frame on your form, or you can use the GroupName property. GroupName is more efficient for the following reasons:

•	You do not have to include a Frame for each group. By not using a Frame, you reduce the number of controls on the form, and in turn, improve performance and reduce the size of the form.

•	You have more design flexibility. If you use a Frame to create the group, all the buttons must be inside the Frame. If you want more than one group, you must have one Frame for each group. However, if you use GroupName to create the group, the group can include option buttons anywhere on the form. If you want more than one group, specify a unique name for each group; you can still place the individual controls anywhere on the form.

•	You can create buttons with transparent backgrounds, which can improve the visual appearance of your form. The Frame is not a transparent control.

Regardless of which method you use to create the group of buttons, clicking one button in a group sets all other buttons in the same group to False. All option buttons with the same GroupName within a single container are mutually exclusive. You can use the same group name in two containers, but doing so creates two groups (one in each container) rather than one group that includes both containers.

For example, assume your form includes some option buttons and a MultiPage that also includes option buttons. The option buttons on the MultiPage are one group and the buttons on the form are another group. The two groups do not affect each other. Changing the setting of a button on the MultiPage does not affect the buttons on the form.


Height Property
Height, Width Properties

The height or width, in points, of an object.

Syntax

object.Height [= Single]

object.Width [= Single]

The Height and Width property syntaxes have these parts:

Part	Description
object	Required. A valid object.
Single	Optional. A numeric expression specifying the dimensions of an object.
Remarks

The Height and Width properties are automatically updated when you move or size a control. If you specify a setting for the Left or Top property that is less than zero, that value will be used to calculate the height or width of the control, but a portion of the control will not be visible on the form.

If you move a control from one part of a form to another, the setting of Height or Width only changes if you size the control as you move it. The settings of the control’s Left and Top properties will change to reflect the control’s new position relative to the edges of the form that contains it.

The value assigned to Height or Width must be greater than or equal to zero. For most systems, the recommended range of values is from 0 to +32,767. Higher values may also work depending on your system configuration.

For most systems, the recommended range of values for Left and Top is from -32,767 to +32,767. Other values may also work depending on your system configuration. For a ComboBox, values of Left and Top apply to the text portion of the control, not to the list portion. When you move or size a control, its new Left setting is automatically entered in the property sheet. When you print a form, the control's horizontal or vertical location is determined by its Left or Top setting.


HideSelection Property

Specifies whether selected text remains highlighted when a control does not have the focus.

Syntax

object.HideSelection [= Boolean]

The HideSelection property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the selected text remains highlighted even when the control does not have the focus.
Settings

The settings for Boolean are:

Value	Description
True	Selected text is not highlighted unless the control has the focus (default).
False	Selected text always appears highlighted.
Remarks

You can use the HideSelection property to maintain highlighted text when another form or a dialog box receives the focus, such as in a spell-checking procedure.


Index Property

The position of a Tab object within a Tabs collection or a Page object in a Pages collection.

Syntax

object.Index [= Integer]

The Index property syntax has these parts:

Part	Description
object	Required. A valid object.
Integer	Optional. The index of the currently selected Tab object.
Remarks

The Index property specifies the order in which tabs appear. Changing the value of Index visually changes the order of Pages in a MultiPage or Tabs on a TabStrip. The index value for the first page or tab is zero, the index value of the second page or tab is one, and so on.

In a MultiPage, Index refers to a Page as well as the page’s Tab. In a TabStrip, Index refers to the tab only.


InsideHeight Property
InsideHeight, InsideWidth Properties

InsideHeight returns the height, in points, of the client region inside a form. InsideWidth returns the width, in points, of the client region inside a form.

Syntax

object.InsideHeight

object.InsideWidth

The InsideHeight and InsideWidth property syntaxes have these parts:

Part	Description
object	Required. A valid object.
Remarks

The InsideHeight and InsideWidth properties are read-only. If the region includes a scroll bar, the returned value does not include the height or width of the scroll bar.


IntegralHeight Property

Indicates whether a ListBox or TextBox displays full lines of text in a list or partial lines.

Syntax

object.IntegralHeight [= Boolean]

The IntegralHeight property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the list displays partial lines of text.
Settings

The settings for Boolean are:

Value	Description
True	The list resizes itself to display only complete items (default).
False	The list does not resize itself even if the item is too tall to display completely.
Remarks

The IntegralHeight property relates to the height of the list, just as the AutoSize property relates to the width of the list.

If IntegralHeight is True, the list box automatically resizes when necessary to show full rows. If False, the list remains a fixed size; if items are taller than the available space in the list, the entire item is not shown.


KeepScrollBarsVisible Property

Specifies whether scroll bars remain visible when not required.

Syntax

object.KeepScrollBarsVisible [=ScrollBars]

The KeepScrollBarsVisible property syntax has these parts:

Part	Description
object	Required. A valid object.
ScrollBars	Optional. Where scroll bars are displayed.
Settings

The settings for ScrollBars are:

Value	Description
0	Displays no scroll bars.
1	Displays a horizontal scroll bar.
2	Displays a vertical scroll bar.
3	Displays both a horizontal and a vertical scroll bar (default).
Remarks

If the visible region is large enough to display all the controls on an object such as a Page object or a form, scroll bars are not required. The KeepScrollBarsVisible property determines whether the scroll bars remain visible when they are not required.

If the scroll bars are visible when they are not required, they appear normal in size, and the scroll box fills the entire width or height of the scroll bar.

If the KeepScrollBarsVisible property is True, any scroll bar on a form or page is always visible, regardless of whether the object's contents fit within the object's borders.


LargeChange Property

Specifies the amount of movement that occurs when the user clicks between the scroll box and scroll arrow.

Syntax

object.LargeChange [= Long]

The LargeChange property syntax has these parts:

Part	Description
object	Required. A valid object.
Long	Optional. An integer that specifies the amount of change to the Value property.
Remarks

The LargeChange property applies only to the ScrollBar. It does not apply to the scrollbars in other controls such as a TextBox or a drop-down ComboBox.

The value of LargeChange is the amount by which the ScrollBar’s Value property changes when the user clicks the area between the scroll box and scroll arrow. The direction of the movement is always toward the place where the user clicks. For example, in a horizontal ScrollBar, clicking to the left of the scroll box moves the scroll box to the left. In a vertical ScrollBar, clicking above the scroll box moves the scroll box up.

LargeChange does not have units. Any integer is a valid setting for LargeChange. The recommended range of values is from –32,767 to +32,767, and the value must be between the values of the Max and Min properties of the ScrollBar.


Left Property
Left, Top Properties

The distance between a control and the left or top edge of the form that contains it.

Syntax

object.Left [= Single]

object.Top [= Single]

The Left and Top property syntaxes have these parts:

Part	Description
object	Required. A valid object.
Single	Optional. A numeric expression specifying the coordinates of an object.
Settings

Setting the Left or Top property to 0 places the control's edge at the left or top edge of its container.

Remarks

For most systems, the recommended range of values for Left and Top is from -32,767 to +32,767. Other values may also work depending on your system configuration. For a ComboBox, values of Left and Top apply to the text portion of the control, not to the list portion. When you move or size a control, its new Left setting is automatically entered in the property sheet. When you print a form, the control's horizontal or vertical location is determined by its Left or Top setting.

The Height and Width properties are automatically updated when you move or size a control. If you specify a setting for the Left or Top property that is less than zero, that value will be used to calculate the height or width of the control, but a portion of the control will not be visible on the form.

If you move a control from one part of a form to another, the setting of Height or Width only changes if you size the control as you move it. The settings of the control’s Left and Top properties will change to reflect the control’s new position relative to the edges of the form that contains it.

The value assigned to Height or Width must be greater than or equal to zero. For most systems, the recommended range of values is from 0 to +32,767. Higher values may also work depending on your system configuration.


LineCount Property

Returns the number of text lines in a TextBox or ComboBox.

Syntax

object.LineCount

The LineCount property syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

The LineCount property is read-only.

Note  A ComboBox will only have one line.


List Property

Returns or sets the list entries of a ListBox or ComboBox.

Syntax

object.List( row, column ) [= Variant]

The List property syntax has these parts:

Part	Description
object	Required. A valid object.
row	Required. An integer with a range from 0 to one less than the number of entries in the list.
column	Required. An integer with a range from 0 to one less than the number of columns.
Variant	Optional. The contents of the specified entry in the ListBox or ComboBox.
Settings

Row and column numbering begins with zero. That is, the row number of the first row in the list is zero; the column number of the first column is zero. The number of the second row or column is 1, and so on.

Remarks

The List property works with the ListCount and ListIndex properties. Use List to access list items. A list is a variant array; each item in the list has a row number and a column number.

Initially, ComboBox and ListBox contain empty lists.

Note  To specify items you want to display in a ComboBox or ListBox, use the AddItem method. To remove items, use the RemoveItem method.

Use List to copy an entire two-dimensional array of values to a control. Use AddItem to load a one-dimensional array or to load an individual element.


ListCount Property

Returns the number of list entries in a control.

Syntax

object.ListCount

The ListCount property syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

The ListCount property is read-only. ListCount is the number of rows over which you can scroll. ListCount is always one greater than the largest value for the ListIndex property, because index numbers begin with 0 and the count of items begins with 1. If no item is selected, ListCount is 0 and ListIndex is –1.


ListIndex Property

Identifies the currently selected item in a ListBox or ComboBox.

Syntax

object.ListIndex [= Variant]

The ListIndex property syntax has these parts:

Part	Description
object	Required. A valid object.
Variant	Optional. The currently selected item in the control.
Remarks

The ListIndex property contains an index of the selected row in a list. Values of ListIndex range from –1 to one less than the total number of rows in a list (that is, ListCount – 1). When no rows are selected, ListIndex returns –1. When the user selects a row in a ListBox or ComboBox, the system sets the ListIndex value. The ListIndex value of the first row in a list is 0, the value of the second row is 1, and so on.

Note  If you use the MultiSelect property to create a ListBox that allows multiple selections, the Selected property of the ListBox (rather than the ListIndex property) identifies the selected rows. The Selected property is an array with the same number of values as the number of rows in the ListBox. For each row in the list box, Selected is True if the row is selected and False if it is not. In a ListBox that allows multiple selections, ListIndex returns the index of the row that has focus, regardless of whether that row is currently selected.

The ListIndex value is also available by setting the BoundColumn property to 0 for a combo box or list box. If BoundColumn is 0, the underlying data source to which the combo box or list box is bound contains the same list index value as ListIndex.


ListStyle Property

Specifies the visual appearance of the list in a ListBox or ComboBox.

Syntax

object.ListStyle [=ListStyle]

The ListStyle property syntax has these parts:

Part	Description
object	Required. A valid object.
ListStyle	Optional. The visual style of the list.
Settings

The settings for ListStyle are:

Value	Description
0	Looks like a regular list box, with the background of items highlighted.
1	Shows option buttons, or check boxes for a multi-select list (default). When the user selects an item from the group, the option button associated with that item is selected and the option buttons for the other items in the group are deselected.
Remarks

The ListStyle property lets you change the visual presentation of a ListBox or ComboBox. By specifying a setting other than 0, you can present the contents of either control as a group of individual items, with each item including a visual cue to indicate whether it is selected.

If the control supports a single selection (the MultiSelect property is set to 0), the user can press one button in the group. If the control supports multi-select, the user can press two or more buttons in the group.


ListWidth Property

Specifies the width of the list in a ComboBox.

Syntax

object.ListWidth [= Variant]

The ListWidth property syntax has these parts:

Part	Description
object	Required. A valid object.
Variant	Optional. The width of the list. A value of zero makes the list as wide as the ComboBox. The default value is to make the list as wide as the text portion of the control.
Remarks

If you want to display a multicolumn list, enter a value that will make the list box wide enough to fit all the columns.

Tip  When designing combo boxes, be sure to leave enough space to display your data and for a vertical scroll bar.


Locked Property

Specifies whether a control can be edited.

Syntax

object.Locked [= Boolean]

The Locked property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the control can be edited.
Settings

The settings for Boolean are:

Value	Description
True	You can't edit the value.
False	You can edit the value (default).
Remarks

When a control is locked and enabled, it can still initiate events and can still receive the focus.

The Enabled and Locked properties work together to achieve the following effects:

•	If Enabled and Locked are both True, the control can receive focus and appears normally (not dimmed) in the form. The user can copy, but not edit, data in the control.

•	If Enabled is True and Locked is False, the control can receive focus and appears normally in the form. The user can copy and edit data in the control.

•	If Enabled is False and Locked is True, the control cannot receive focus and is dimmed in the form. The user can neither copy nor edit data in the control.

•	If Enabled and Locked are both False, the control cannot receive focus and is dimmed in the form. The user can neither copy nor edit data in the control.


MatchEntry Property

Returns or sets a value indicating how a ListBox or ComboBox searches its list as the user types.

Syntax

object.MatchEntry [=MatchEntry]

The MatchEntry property syntax has these parts:

Part	Description
object	Required. A valid object.
MatchEntry	Optional. The rule used to match entries in the list.
Settings

The settings for MatchEntry are:

Value	Description
0	Basic matching. The control searches for the next entry that starts with the character entered. Repeatedly typing the same letter cycles through all entries beginning with that letter.
1	Extended matching. As each character is typed, the control searches for an entry matching all characters entered (default).
2	No matching.
Remarks

The MatchEntry property searches entries from the TextColumn property of a ListBox or ComboBox.

The control searches the column identified by TextColumn for an entry that matches the user's typed entry. Upon finding a match, the row containing the match is selected, the contents of the column are displayed, and the contents of its BoundColumn property become the value of the control. If the match is unambiguous, finding the match initiates the Click event.

The control initiates the Click  event as soon as the user types a sequence of characters that match exactly one entry in the list. As the user types, the entry is compared with the current row in the list and with the next row in the list. When the entry matches only the current row, the match is unambiguous.

In Microsoft Forms, this is true regardless of whether the list is sorted. This means the control finds the first occurrence that matches the entry, based on the order of items in the list. For example, entering either “abc” or “bc” will initiate the Click event for the following list:

abcde

bcdef

abcxyz

bchij

Note that in either case, the matched entry is not unique; however, it is sufficiently different from the adjacent entry that the control interprets the match as unambiguous and initiates the Click event.


MatchFound Property

Indicates whether the text that a user has typed into a ComboBox matches any of the entries in the list.

Syntax

object.MatchFound

The MatchFound property syntax has these parts:

Part	Description
object	Required. A valid object.
Return Values

The MatchFound property return values are:

Value	Description
True	The contents of the Value property matches one of the records in the list.
False	The contents of Value does not match any of the records in the list (default).
Remarks

The MatchFound property is read-only. It is not applicable when the MatchEntry property is set to 2.


MatchRequired Property

Specifies whether a value entered in the text portion of a ComboBox must match an entry in the existing list portion of the control. The user can enter non-matching values, but may not leave the control until a matching value is entered.

Syntax

object.MatchRequired [= Boolean]

The MatchRequired property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the text entered must match an existing item in the list.
Settings

The settings for Boolean are:

Value	Description
True	The text entered must match an existing list entry.
False	The text entered can be different from all existing list entries (default).
Remarks

If the MatchRequired property is True, the user cannot exit the ComboBox until the text entered matches an entry in the existing list. MatchRequired maintains the integrity of the list by requiring the user to select an existing entry.

Note  Not all containers enforce this property.


Max Property
Max, Min Properties

Specify the maximum and minimum acceptable values for the Value property of a ScrollBar or SpinButton.

Syntax

object.Max [= Long]

object.Min [= Long]

The Max and Min property syntaxes have these parts:

Part	Description
object	Required. A valid object.
Long	Optional. A numeric expression specifying the maximum or minimum Value property setting.
Remarks

Clicking a SpinButton or moving the scroll box in a ScrollBar changes the Value property of the control.

The value for the Max property corresponds to the lowest position of a vertical ScrollBar or the rightmost position of a horizontal ScrollBar. The value for the Min property corresponds to the highest position of a vertical ScrollBar or the leftmost position of a horizontal ScrollBar.

Any integer is an acceptable setting for this property. The recommended range of values is from –32,767 to +32,767. The default value is 1.

Note  Min and Max refer to locations, not to relative values, on the ScrollBar. That is, the value of Max could be less than the value of Min. If this is the case, moving toward the Max (bottom) position means decreasing Value; moving toward the Min (top) position means increasing Value.


MaxLength Property

Specifies the maximum number of characters a user can enter in a TextBox or ComboBox.

Syntax

object.MaxLength [= Long]

The MaxLength property syntax has these parts:

Part	Description
object	Required. A valid object.
Long	Optional. An integer indicating the allowable number of characters.
Remarks

Setting the MaxLength property to 0 indicates there is no limit other than that created by memory constraints.


MouseIcon Property

Assigns a custom icon to an object.

Syntax

object.MouseIcon = LoadPicture( pathname )

The MouseIcon property syntax has these parts:

Part	Description
object	Required. A valid object.
pathname	Required. A string expression specifying the path and filename of the file containing the custom icon.
Remarks

The MouseIcon property is valid when the MousePointer property is set to 99. The mouse icon of an object is the image that appears when the user moves the mouse across that object.

To assign an image for the mouse pointer, you can either assign a picture to the MouseIcon property or load a picture from a file using the LoadPicture function.


MousePointer Property

Specifies the type of pointer displayed when the user positions the mouse over a particular object.

Syntax

object.MousePointer [=MousePointer]

The MousePointer property syntax has these parts:

Part	Description
object	Required. A valid object.
MousePointer	Optional. The shape you want for the mouse pointer.
Settings

The settings for MousePointer are:

Value	Description
0	Standard pointer. The image is determined by the object (default).
1	Arrow.
2	Cross-hair pointer.
3	I-beam.
6	Double arrow pointing northeast and southwest.
7	Double arrow pointing north and south.
8	Double arrow pointing northwest and southeast.
9	Double arrow pointing west and east.
10	Up arrow.
11	Hourglass.
12	"Not" symbol (circle with a diagonal line) on top of the object being dragged. Indicates an invalid drop target.
13	Arrow with an hourglass.
14	Arrow with a question mark.
15	Size all cursor (arrows pointing north, south, east, and west).
99	Uses the icon specified by the MouseIcon property.
Remarks

Use the MousePointer property when you want to indicate changes in functionality as the mouse pointer passes over controls on a form. For example, the hourglass setting (11) is useful to indicate that the user must wait for a process or operation to finish.

Some icons vary depending on system settings, such as the icons associated with desktop themes.


MultiLine Property

Specifies whether a control can accept and display multiple lines of text.

Syntax

object.MultiLine [= Boolean]

The MultiLine property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the control supports more than one line of text.
Settings

The settings for Boolean are:

Value	Description
True	The text is displayed across multiple lines (default).
False	The text is not displayed across multiple lines.
Remarks

A multiline TextBox allows absolute line breaks and adjusts its quantity of lines to accommodate the amount of text it holds. If needed, a multiline control can have vertical scroll bars.

A single-line TextBox doesn’t allow absolute line breaks and doesn’t use vertical scroll bars.

For controls that support the MultiLine property as well as the WordWrap property, WordWrap is ignored when MultiLine is False.

Single-line controls ignore the value of the WordWrap property.

Note   If you change MultiLine to False in a multiline TextBox, all the characters in the TextBox will be combined into one line, including non-printing characters (such as carriage returns and new-lines).

The EnterKeyBehavior and MultiLine properties are closely related. The EnterKeyBehavior values of True and False only apply if MultiLine is True. If MultiLine is False, pressing ENTER always moves the focus to the next control in the tab order regardless of the value of EnterKeyBehavior.

The effect of pressing CTRL+ENTER also depends on the value of MultiLine. If MultiLine is True, pressing CTRL+ENTER creates a new line regardless of the value of EnterKeyBehavior. If MultiLine is False, pressing CTRL+ENTER has no effect.

The TabKeyBehavior and MultiLine properties are closely related. The values described above only apply if MultiLine is True. If MultiLine is False, pressing TAB always moves the focus to the next control in the tab order regardless of the value of TabKeyBehavior.

The effect of pressing CTRL+TAB also depends on the value of MultiLine. If MultiLine is True, pressing CTRL+TAB creates a new line regardless of the value of TabKeyBehavior. If MultiLine is False, pressing CTRL+TAB has no effect.


MultiRow Property

Specifies whether the control has more than one row of tabs.

Syntax

object.MultiRow [= Boolean]

The MultiRow property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the control has more than one row of tabs.
Settings

The settings for Boolean are:

Value	Description
True	Allows more than one row of tabs.
False	Restricts tabs to a single row (default).
Remarks

The width and number of tabs determines the number of rows. Changing the control's size also changes the number of rows. This allows the developer to resize the control and ensure that tabs wrap to fit the control. If the MultiRow property is False, then truncation occurs if the width of the tabs exceeds the width of the control.

If MultiRow is False and tabs are truncated, there will be a small scroll bar on the TabStrip to allow scrolling to the other tabs or pages.


MultiSelect Property

Indicates whether the object permits multiple selections.

Syntax

object.MultiSelect [=MultiSelect]

The MultiSelect property syntax has these parts:

Part	Description
object	Required. A valid object.
MultiSelect	Optional. The selection mode that the control uses.
Settings

The settings for MultiSelect are:

Value	Description
0	Only one item can be selected (default).
1	Pressing the SPACEBAR or clicking selects or deselects an item in the list.
2	Pressing SHIFT and clicking the mouse, or pressing SHIFT and one of the arrow keys, extends the selection from the previously selected item to the current item. Pressing CTRL and clicking the mouse selects or deselects an item.
Remarks

When the MultiSelect property is set to Extended or Simple, you must use the list box's Selected property to determine the selected items. Also, the Value property of the control is always Null.

The ListIndex property returns the index of the row with the keyboard focus.


Name Property

Specifies the name of a control or an object, or the name of a font to associate with a Font object.

Syntax

For Font
Font.Name [= String]

For all other controls and objects
object.Name [= String]

The Name property syntax has these parts:

Part	Description
object	Required. A valid object.
String	Optional. The name you want to assign to the font or control.
Settings

Guidelines for assigning a string to Name, such as the maximum length of the name, vary from one application to another.

Remarks

For objects, the default value of Name consists of the object's class name followed by an integer. For example, the default name for the first TextBox you place on a form is TextBox1. The default name for the second TextBox is TextBox2.

You can set the Name property for a control from the control's property sheet or, for controls added at run time, by using program statements. If you add a control at design time, you cannot modify its Name property at run time.

Each control added to a form at design time must have a unique name.

For Font objects, Name identifies a particular typeface to use in the text portion of a control, object, or form. The font's appearance on screen and in print may differ, depending on your computer and printer. If you select a font that your system can't display or that isn't installed, Windows substitutes a similar font.


Object Property

Overrides a standard property or method when a new control has a property or method of the same name.

Syntax

object.Object[.property |.method]

The Object property syntax has these parts:

Part	Description
object	Required. The name of an object you have added to the Microsoft Forms Toolbox.
property	Optional. A property that has the same name as a standard Microsoft Forms property.
method	Optional. A method that has the same name as a standard Microsoft Forms method.
Remarks

Object is read-only.

If you add a new control to the Microsoft Forms Toolbox, it is possible that the added control will have a property or method with the same name as a standard Microsoft Forms property or method. The Object property lets you use the property or method from the added control, rather than the standard property or method.


Orientation Property

Specifies whether the SpinButton or ScrollBar is oriented vertically or horizontally.

Syntax

object.Orientation [=Orientation]

The Orientation property syntax has these parts:

Part	Description
object	Required. A valid object.
Orientation	Optional. Orientation of the control.
Settings

The settings for Orientation are:

Value	Description
–1	Automatically determines the orientation based upon the dimensions of the control (default).
0	Control is rendered vertically.
1	Control is rendered horizontally.
Remarks

If you specify automatic orientation, the height and width of the control determine whether it appears horizontally or vertically. For example, if the control is wider than it is tall, it appears horizontally; if it is taller than it is wide, the control appears vertically.


Parent Property

Returns the name of the form, object, or collection that contains a specific control, object, or collection.

Syntax

object.Parent

The Parent property syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

Parent is read-only.

Use the Parent property to access the properties, methods, or controls of an object's parent.

This property is useful in an application in which you pass objects as arguments. For example, you could pass a control variable to a general procedure in a module, and use Parent to access its parent form.


PasswordChar Property

Specifies whether placeholder characters are displayed instead of the characters actually entered in a TextBox.

Syntax

object.PasswordChar [= String]

The PasswordChar property syntax has these parts:

Part	Description
object	Required. A valid object.
String	Optional. A string expression specifying the placeholder character.
Remarks

You can use the PasswordChar property to protect sensitive information, such as passwords or security codes. The value of PasswordChar is the character that appears in a control instead of the actual characters that the user types. If you don't specify a character, the control displays the characters that the user types.


Picture Property

Specifies the bitmap to display on an object.

Syntax

object.Picture = LoadPicture( pathname )

The Picture property syntax has these parts:

Part	Description
object	Required. A valid object.
pathname	Required. The full path to a picture file.
Remarks

You must use the control’s property page to assign a bitmap to the Picture property. You cannot use the LoadPicture function to assign a bitmap to Picture.

To remove a picture that is assigned to a control, click the value of the Picture property in the property page and then press DELETE. Pressing BACKSPACE will not remove the picture.

Note   For controls with captions, use the PicturePosition property to specify where to display the picture on the object. Use the PictureSizeMode property to determine how the picture fills the object.

Transparent pictures sometimes have a hazy appearance. If you do not like this appearance, display the picture on a control that supports opaque images. Image and MultiPage support opaque images.


PictureAlignment Property

Specifies the location of a background picture.

Syntax

object.PictureAlignment [=PictureAlignment]

The PictureAlignment property syntax has these parts:

Part	Description
object	Required. A valid object.
PictureAlignment	Optional. The position where the picture aligns with the control.
Settings

The settings for PictureAlignment are:

Value	Description
0	The top left corner.
1	The top right corner.
2	The center.
3	The bottom left corner.
4	The bottom right corner.
Remarks

The PictureAlignment property identifies which corner of the picture is the same as the corresponding corner of the control or container where the picture is used.

For example, setting PictureAlignment to 0 means that the top left corner of the picture coincides with the top left corner of the control or container. Setting PictureAlignment to 2 positions the picture in the middle, relative to the height as well as the width of the control or container.

If you tile an image on a control or container, the setting of PictureAlignment affects the tiling pattern. For example, if PictureAlignment is set to 0, the first copy of the image is laid in the upper left corner of the control or container and additional copies are tiled from left to right across each row. If PictureAlignment is 2, the first copy of the image is laid at the center of the control or container, additional copies are laid to the left and right to complete the row, and additional rows are added to fill the control or container.

Note  Setting the PictureSizeMode property to 2 overrides PictureAlignment. When PictureSizeMode is set to 2, the picture fills the entire control or container.


PicturePosition Property

Specifies the location of the picture relative to its caption.

Syntax

object.PicturePosition [=PicturePosition]

The PicturePosition property syntax has these parts:

Part	Description
object	Required. A valid object.
PicturePosition	Optional. How the picture aligns with its container.
Settings

The settings for PicturePosition are:

Value	Description
0	The picture appears to the left of the caption. The caption is aligned with the top of the picture.
1	The picture appears to the left of the caption. The caption is centered relative to the picture.
2	The picture appears to the left of the caption. The caption is aligned with the bottom of the picture.
3	The picture appears to the right of the caption. The caption is aligned with the top of the picture.
4	The picture appears to the right of the caption. The caption is centered relative to the picture.
5	The picture appears to the right of the caption. The caption is aligned with the bottom of the picture.
6	The picture appears above the caption. The caption is aligned with the left edge of the picture.
7	The picture appears above the caption. The caption is centered below the picture (default).
8	The picture appears above the caption. The caption is aligned with the right edge of the picture.
9	The picture appears below the caption. The caption is aligned with the left edge of the picture.
10	The picture appears below the caption. The caption is centered above the picture.
11	The picture appears below the caption. The caption is aligned with the right edge of the picture.
12	The picture appears in the center of the control. The caption is centered horizontally and vertically on top of the picture.
Remarks

The picture and the caption, as a unit, are centered on the control. If no caption exists, the picture’s location is relative to the center of the control.

This property is ignored if the Picture property does not specify a picture.


PictureSizeMode Property

Specifies how to display the background picture on a control, form, or page.

Syntax

object.PictureSizeMode [=PictureSizeMode]

The PictureSizeMode property syntax has these parts:

Part	Description
object	Required. A valid object.
PictureSizeMode	Optional. The action to take if the picture and the form or page that contains it are not the same size.
Settings

The settings for PictureSizeMode are:

Value	Description
0	Crops any part of the picture that is larger than the form or page (default).
1	Stretches the picture to fill the form or page. This setting distorts the picture in either the horizontal or vertical direction.
3	Enlarges the picture, but does not distort the picture in either the horizontal or vertical direction.
Remarks

The PictureSizeModeClip setting indicates you want to show the picture in its original size and scale. If the form or page is smaller than the picture, this setting only shows the part of the picture that fits within the form or page.

The 1 and 3 settings both enlarge the image, but 1 causes distortion. The 1 setting enlarges the image horizontally and vertically until the image reaches the corresponding edges of the container or control. The 3 setting enlarges the image until it reaches either the horizontal or vertical edges of the container or control. If the image reaches the horizontal edges first, any remaining distance to the vertical edges remains blank. If it reaches the vertical edges first, any remaining distance to the horizontal edges remains blank.

Note  Setting the PictureSizeMode property to 2 overrides PictureAlignment. When PictureSizeMode is set to 2, the picture fills the entire control or container.


PictureTiling Property

Lets you tile a picture in a form or page.

Syntax

object.PictureTiling [= Boolean]

The PictureTiling property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether a picture is repeated across a background.
Settings

The settings for Boolean are:

Value	Description
True	The picture is tiled across the background.
False	The picture is not tiled across the background (default).
Remarks

If a picture is smaller than the form or page that contains it, you can tile the picture on the form or page.

The tiling pattern depends on the current setting of the PictureAlignment and PictureSizeMode properties. For example, if PictureAlignment is set to 0, the tiling pattern starts at the upper left and repeats the picture across the form or page and down the height of the form or page. If PictureSizeMode is set to 0, the tiling pattern crops the last tile if it doesn't completely fit on the form or page.


ProportionalThumb Property

Specifies whether the size of the scroll box is proportional to the scrolling region or fixed.

Syntax

object.ProportionalThumb [= Boolean]

The ProportionalThumb property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the scroll box is proportional or fixed.
Settings

The settings for Boolean are:

Value	Description
True	The scroll box is proportional in size to the scrolling region (default).
False	The scroll box is a fixed size.
Remarks

The size of a proportional scroll box graphically represents the percentage of the object that is visible in the window. For example, if 75 percent of an object is visible, the scroll box covers three-fourths of the scrolling region in the scroll bar.

If the scroll box is a fixed size, the system determines its size based on the height and width of the scroll bar.


RowSource Property

Specifies the source providing a list for a ComboBox or ListBox.

Syntax

object.RowSource [= String]

The RowSource property syntax has these parts:

Part	Description
object	Required. A valid object.
String	Optional. The source of the list for the ComboBox or ListBox.
Remarks

The RowSource property accepts worksheet ranges from Microsoft Excel.


ScrollBars Property

Specifies whether a control, form, or page has vertical scroll bars, horizontal scroll bars, or both.

Syntax

object.ScrollBars [= ScrollBars]

The ScrollBars property syntax has these parts:

Part	Description
object	Required. A valid object.
ScrollBars	Optional. Where scroll bars should be displayed.
Settings

The settings for ScrollBars are:

Value	Description
0	Displays no scroll bars (default).
1	Displays a horizontal scroll bar.
2	Displays a vertical scroll bar.
3	Displays both a horizontal and a vertical scroll bar.
Remarks

If the KeepScrollBarsVisible property is True, any scroll bar on a form or page is always visible, regardless of whether the object's contents fit within the object's borders.

If visible, a scroll bar constrains its scroll box to the visible region of the scroll bar. It also modifies the scroll position as needed to keep the entire scroll bar visible. The range of a scroll bar changes when the value of the ScrollBars property changes, the scroll size changes, or the visible size changes.

If a scroll bar is not visible, then you can set its scroll position to any value. Negative values and values greater than the scroll size are both valid.

For a single-line control, you can display a horizontal scroll bar by using the ScrollBars and AutoSize properties. Scroll bars are hidden or displayed according to the following rules:

1.	When ScrollBars is set to ScrollBarsNone, no scroll bar is displayed.

2.	When ScrollBars is set to 1 or 3, the control displays a horizontal scroll bar if the text is longer than the edit region and if the control has enough room to include the scroll bar underneath its edit region.

3.	When AutoSize is True, the control enlarges itself to accommodate the addition of a scroll bar unless the control is at or near its maximum size.

For a multiline TextBox, you can display scroll bars by using the ScrollBars, WordWrap, and AutoSize properties. Scroll bars are hidden or displayed according to the following rules:

1.	When ScrollBars is set to 0, no scroll bar is displayed.

2.	When ScrollBars is set to 2 or 3, the control displays a vertical scroll bar if the text is longer than the edit region and if the control has enough room to include the scroll bar at the right edge of its edit region.

3.	When WordWrap is True, the multiline control will not display a horizontal scroll bar. Most multiline controls do not use a horizontal scroll bar.

4.	A multiline control can display a horizontal scroll bar if the following conditions occur simultaneously:

•	The edit region contains a word that is longer than the edit region’s width.

•	The control has enabled horizontal scroll bars.

•	The control has enough room to include the scroll bar under the edit region.

•	The WordWrap property is set to False.


ScrollHeight Property
ScrollHeight, ScrollWidth Properties

Specify the height, in points, of the total area that can be viewed by moving the scroll bars on the control, form, or page.

Syntax

object.ScrollHeight [= Single]

object.ScrollWidth [= Single]

The ScrollHeight and ScrollWidth property syntaxes have these parts:

Part	Description
object	Required. A valid object.
Single	Optional. The height or width of the scrollable region.


ScrollLeft Property
ScrollLeft, ScrollTop Properties

Specify the distance, in points, of the left or top edge of the visible form from the left or top edge of the logical form, page, or control.

Syntax

object.ScrollLeft [= Single]

object.ScrollTop [= Single]

The ScrollLeft and ScrollTop property syntaxes have these parts:

Part	Description
object	Required. A valid object.
Single	Optional. The distance from the edge of the form.
Remarks

The minimum value is zero; the maximum value is the difference between the value of the ScrollWidth property and the value of the Width property for the form or page.


Selected Property

Returns or sets the selection state of items in a ListBox.

Syntax

object.Selected( index ) [= Boolean]

The Selected property syntax has these parts:

Part	Description
object	Required. A valid object.
index	Required. An integer with a range from 0 to one less than the number of items in the list.
Boolean	Optional. Whether an item is selected.
Settings

The settings for Boolean are:

Value	Description
True	The item is selected.
False	The item is not selected.
Remarks

The Selected property is useful when users can make multiple selections. You can use this property to determine the selected rows in a multi-select list box. You can also use this property to select or deselect rows in a list from code.

The default value of this property is based on the current selection state of the ListBox.

For single-selection list boxes, the Value or ListIndex properties are recommended for getting and setting the selection. In this case, ListIndex returns the index of the selected item. However, in a multiple selection, ListIndex returns the index of the row contained within the focus rectangle, regardless of whether the row is actually selected.

When a list box control's MultiSelect property is set to None, only one row can have its Selected property set to True.

Entering a value that is out of range for the index does not generate an error message, but does not set a property for any item in the list.


SelectedItem Property

Returns the currently selected Tab or Page object.

Syntax

object.SelectedItem

The SelectedItem property syntax has these parts:

Part	Description
object	Required. A valid TabStrip or MultiPage.
Remarks

The SelectedItem property is read-only. Use SelectedItem to programmatically control the currently selected Tab or Page object. For example, you can use SelectedItem to assign values to properties of a Tab or Page object.


SelectionMargin Property

Specifies whether the user can select a line of text by clicking in the region to the left of the text.

Syntax

object.SelectionMargin [= Boolean]

The SelectionMargin property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether clicking in the margin selects a line of text.
Settings

The settings for Boolean are:

Value	Description
True	Clicking in margin causes selection of text (default).
False	Clicking in margin does not cause selection of text.
Remarks

When the SelectionMargin property is True, the selection margin occupies a thin strip along the left edge of a control’s edit region. When set to False, the entire edit region can store text.

If the SelectionMargin property is set to True when a control is printed, the selection margin also prints.


SelLength Property

The number of characters selected in a TextBox or the text portion of a ComboBox.

Syntax

object.SelLength [= Long]

The SelLength property syntax has these parts:

Part	Description
object	Required. A valid object.
Long	Optional. A numeric expression specifying the number of characters selected. For SelLength and SelStart, the valid range of settings is 0 to the total number of characters in the edit area of a ComboBox or TextBox.
Remarks

The SelLength property is always valid, even when the control does not have focus. Setting SelLength to a value less than zero creates an error. Attempting to set SelLength to a value greater than the number of characters available in a control results in a value equal to the number of characters in the control.

Note  Changing the value of the SelStart property cancels any existing selection in the control, places an insertion point in the text, and sets SelLength to zero.

The default value, zero, means that no text is currently selected.


SelStart Property

Indicates the starting point of selected text, or the insertion point if no text is selected.

Syntax

object.SelStart [= Long]

The SelStart property syntax has these parts:

Part	Description
object	Required. A valid object.
Long	Optional. A numeric expression specifying the starting point of text selected. For SelLength and SelStart, the valid range of settings is 0 to the total number of characters in the edit area of a ComboBox or TextBox. The default value is zero.
Remarks

The SelStart property is always valid, even when the control does not have focus. Setting SelStart to a value less than zero creates an error. Attempting to set SelStart to a value greater than the number of characters available in a control results in a value equal to the number of characters in the control.

Changing the value of SelStart cancels any existing selection in the control, places an insertion point in the text, and sets the SelLength property to zero.


SelText Property

Returns or sets the selected text of a control.

Syntax

object.SelText [= String]

The SelText property syntax has these parts:

Part	Description
object	Required. A valid object.
String	Optional. A string expression containing the selected text.
Remarks

If no characters are selected in the edit region of the control, the SelText property returns a zero length string. This property is valid regardless of whether the control has the focus.


ShowDropButtonWhen Property

Specifies when to show the drop-down button for a ComboBox.

Syntax

object.ShowDropButtonWhen [=ShowDropButtonWhen]

The ShowDropButtonWhen property syntax has these parts:

Part	Description
object	Required. A valid object.
ShowDropButtonWhen	Optional. The circumstances under which the drop-down button will be visible.
Settings

The settings for ShowDropButtonWhen are:

Value	Description
0	Do not show the drop-down button under any circumstances.
1	Show the drop-down button when the control has the focus.
2	Always show the drop-down button.
For a ComboBox, the default value is 2.


SmallChange Property

Specifies the amount of movement that occurs when the user clicks either scroll arrow in a ScrollBar or SpinButton.

Syntax

object.SmallChange [= Long]

The SmallChange property syntax has these parts:

Part	Description
object	Required. A valid object.
Long	Optional. An integer that specifies the amount of change to the Value property.
Remarks

The SmallChange property does not have units.

Any integer is an acceptable setting for this property. The recommended range of values is from –32,767 to +32,767. The default value is 1.


SpecialEffect Property

Specifies the visual appearance of an object.

Syntax

object.SpecialEffect [=SpecialEffect]

The SpecialEffect property syntax has these parts:

Part	Description
object	Required. A valid object.
SpecialEffect	Optional. The desired visual appearance of an object other than a CheckBox, OptionButton, or ToggleButton.
Settings

The settings for SpecialEffect are:

Value	Description
0	Object appears flat, distinguished from the surrounding form by a border, a change of color, or both. Default for Image and Label, valid for all controls.
1	Object has a highlight on the top and left and a shadow on the bottom and right. Not valid for check boxes or option buttons.
2	Object has a shadow on the top and left and a highlight on the bottom and right. The control and its border appear to be carved into the form that contains them. Default for CheckBox and OptionButton, valid for all controls (default).
3	Border appears to be carved around the edge of the control. Not valid for check boxes or option buttons.
6	Object has a ridge on the bottom and right and appears flat on the top and left. Not valid for check boxes or option buttons.
For a Frame, the default value is 2.

Note that only 0 and 2 are acceptable values for CheckBox, OptionButton, and ToggleButton. All values listed are acceptable for other controls.

Remarks

You can use either the SpecialEffect or the BorderStyle property to specify the edging for a control, but not both. If you specify a nonzero value for one of these properties, the system sets the value of the other property to zero. For example, if you set SpecialEffect to 1, the system sets BorderStyle to 0.

For a Frame, BorderStyle is ignored if SpecialEffect is 0.

SpecialEffect uses the system colors to define its borders.

Note   Although the SpecialEffect property exists on the ToggleButton, the property is disabled. You cannot set or return a value for this property on the ToggleButton.


Style Property

For ComboBox, specifies how the user can choose or set the control’s value. For MultiPage and TabStrip, identifies the style of the tabs on the control.

Syntax

object.Style [=Style]

The Style property syntax has these parts:

Part	Description
object	Required. A valid object.
Style	Optional. Specifies how a user sets the value of a ComboBox.
Settings

The settings for Combo Box are:

Value	Description
0	The ComboBox behaves as a drop-down combo box. The user can type a value in the edit region or select a value from the drop-down list (default).
2	The ComboBox behaves as a list box. The user must choose a value from the list.
The settings for MultiPage and Tabstrip are::

Value	Description
0	Displays tabs on the tab bar (default).
1	Displays buttons on the tab bar.
2	Does not display the tab bar.


TabFixedHeight Property
TabFixedHeight, TabFixedWidth Properties

Sets or returns the fixed height or width of the tabs in points.

Syntax

object.TabFixedHeight [= Single]

object.TabFixedWidth [= Single]

The TabFixedHeight and TabFixedWidth property syntaxes have these parts:

Part	Description
object	Required. A valid object.
Single	Optional. The number of points of the height or width of the tabs on a TabStrip or MultiPage.
Settings

If the value is 0, tab widths are automatically adjusted so that each tab is wide enough to accommodate its contents and each row of tabs spans the width of the control.

If the value is greater than 0, all tabs have an identical width as specified by this property.

Remarks

The minimum size is 4 points.


TabIndex Property

Specifies the position of a single object in the form's tab order.

Syntax

object.TabIndex [= Integer]

The TabIndex property syntax has these parts:

Part	Description
object	Required. A valid object.
Integer	Optional. An integer from 0 to one less than the number of controls on the form that have a TabIndex property. Assigning a TabIndex value of less than 0 generates an error. If you assign a TabIndex value greater than the largest index value, the system resets the value to the maximum allowable value.
Remarks

The index value of the first object in the tab order is zero.


TabKeyBehavior Property

Determines whether tabs are allowed in the edit region.

Syntax

object.TabKeyBehavior [= Boolean]

The TabKeyBehavior property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. The effect of pressing TAB.
Settings

The settings for Boolean are:

Value	Description
True	Pressing TAB inserts a tab character in the edit region.
False	Pressing TAB moves the focus to the next object in the tab order (default).
Remarks

The TabKeyBehavior and MultiLine properties are closely related. The values described above only apply if MultiLine is True. If MultiLine is False, pressing TAB always moves the focus to the next control in the tab order regardless of the value of TabKeyBehavior.

The effect of pressing CTRL+TAB also depends on the value of MultiLine. If MultiLine is True, pressing CTRL+TAB creates a new line regardless of the value of TabKeyBehavior. If MultiLine is False, pressing CTRL+TAB has no effect.


TabOrientation Property

Specifies the location of the tabs on a MultiPage or TabStrip.

Syntax

object.TabOrientation [=TabOrientation]

The TabOrientation property syntax has these parts:

Part	Description
object	Required. A valid object.
TabOrientation	Optional. Where the tabs will appear.
Settings

The settings for TabOrientation are:

Value	Description
0	The tabs appear at the top of the control (default).
1	The tabs appear at the bottom of the control.
2	The tabs appear at the left side of the control.
3	The tabs appear at the right side of the control.
Remarks

If you use TrueType fonts, the text rotates when the TabOrientation property is set to 2 or 3. If you use bitmapped fonts, the text does not rotate.


TabStop Property

Indicates whether an object can receive focus when the user tabs to it.

Syntax

object.TabStop [= Boolean]

The TabStop property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the object is a tab stop.
Settings

The settings for Boolean are:

Value	Description
True	Designates the object as a tab stop (default).
False	Bypasses the object when the user is tabbing, although the object still holds its place in the actual tab order, as determined by the TabIndex property.
Remarks

You can combine the settings of the Enabled and the TabStop properties to prevent the user from selecting a command button with TAB, while still allowing the user to click the button. Setting TabStop to False means that the command button won't appear in the tab order. However, if Enabled is True, then the user can still click the command button, as long as TakeFocusOnClick is set to True.

When the user tabs into an enabled MultiPage or TabStrip, the first page or tab in the control receives the focus. If the first page or tab of a MultiPage or TabStrip is disabled, the first enabled page or tab of that control receives the focus. If all pages or tabs of a MultiPage or TabStrip are disabled, the control is disabled and cannot receive the focus.


Tag Property

Stores additional information about an object.

Syntax

object.Tag [= String]

The Tag property syntax has these parts:

Part	Description
object	Required. A valid object.
String	Optional. A string expression identifying the object. The default is a zero-length string ("").
Remarks

Use the Tag property to assign an identification string to an object without affecting other property settings or attributes.

For example, you can use Tag to check the identity of a form or control that is passed as a variable to a procedure.


TakeFocusOnClick Property

Specifies whether a control takes the focus when clicked.

Syntax

object.TakeFocusOnClick [= Boolean]

The TakeFocusOnClick property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Specifies whether a control takes the focus when clicked.
Settings

The settings for Boolean are:

Value	Description
True	The button takes the focus when clicked (default).
False	The button does not take the focus when clicked.
Remarks

The TakeFocusOnClick property defines only what happens when the user clicks a control. If the user tabs to the control, the control takes the focus regardless of the value of TakeFocusOnClick.

Use this property to complete actions that affect a control without requiring that control to give up focus. For example, assume your form includes a TextBox and a CommandButton that checks for correct spelling of text. You would like to be able to select text in the TextBox, then click the CommandButton and run the spelling checker without taking focus away from the TextBox. You can do this by setting the TakeFocusOnClick property of the CommandButton to False.


Text Property

Returns or sets the text in a TextBox. Changes the selected row in a ComboBox or ListBox.

Syntax

object.Text [= String]

The Text property syntax has these parts:

Part	Description
object	Required. A valid object.
String	Optional. A string expression specifying text. The default value is a zero-length string (““).
Remarks

For a TextBox, any value you assign to the Text property is also assigned to the Value property.

For a ComboBox, you can use Text to update the value of the control. If the value of Text matches an existing list entry, the value of the ListIndex property (the index of the current row) is set to the row that matches Text. If the value of Text does not match a row, ListIndex is set to –1.

For a ListBox, the value of Text must match an existing list entry. Specifying a value that does not match an existing list entry causes an error.

When the Text property of a ComboBox changes (such as when a user types an entry into the control), the new text is compared to the column of data specified by TextColumn.

You cannot use Text to change the value of an entry in a ComboBox or ListBox; use the Column or List property for this purpose.

The ForeColor property determines the color of the text.


TextAlign Property

Specifies how text is aligned in a control.

Syntax

object.TextAlign [=TextAlign]

The TextAlign property syntax has these parts:

Part	Description
object	Required. A valid object.
TextAlign	Optional. How text is aligned in the control.
Settings

The settings for TextAlign are:

Value	Description
1	Aligns the first character of displayed text with the left edge of the control's display or edit area (default).
2	Centers the text in the control's display or edit area.
3	Aligns the last character of displayed text with the right edge of the control's display or edit area.
Remarks

For a ComboBox, the TextAlign property only affects the edit region; this property has no effect on the alignment of text in the list. For stand-alone labels, TextAlign determines the alignment of the label's caption.


TextColumn Property

Identifies the column in a ComboBox or ListBox to display to the user.

Syntax

object.TextColumn [= Variant]

The TextColumn property syntax has these parts:

Part	Description
object	Required. A valid object.
Variant	Optional. The column to be displayed.
Settings

Values for the TextColumn property range from –1 to the number of columns in the list. The TextColumn value for the first column is 1, the value of the second column is 2, and so on. Setting TextColumn to 0 displays the ListIndex values. Setting TextColumn to –1 displays the first column that has a ColumnWidths value greater than 0.

Remarks

When the user selects a row from a ComboBox or ListBox, the column referenced by TextColumn is stored in the Text property.For example, you could set up a multicolumn ListBox that contains the names of holidays in one column and dates for the holidays in a second column. To present the holiday names to users, specify the first column as the TextColumn. To store the dates of the holidays, specify the second column as the BoundColumn.

When the Text property of a ComboBox changes (such as when a user types an entry into the control), the new text is compared to the column of data specified by TextColumn.


TextLength Property

Returns the length, in characters, of text in the edit region of a TextBox or ComboBox.

Syntax

object.TextLength

The TextLength property syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

The TextLength property is read-only. For a multiline TextBox, TextLength includes LF (line feed) and CR (carriage return) characters.


TopIndex Property

Sets and returns the item that appears in the topmost position in the list.

Syntax

object.TopIndex [= Variant]

The TopIndex property syntax has these parts:

Part	Description
object	Required. A valid object.
Variant	Optional. The number of the list item that is displayed in the topmost position. The default is 0, or the first item in the list.
Settings

Returns the value –1 if the list is empty or not displayed.


TripleState Property

Determines whether a user can specify, from the user interface, the Null state for a CheckBox or ToggleButton.

Syntax

object.TripleState [= Boolean]

The TripleState property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the control supports the Null state.
Settings

The settings for Boolean are:

Value	Description
True	The button clicks through three states.
False	The button only supports True and False (default).
Remarks

Although the TripleState property exists on the OptionButton, the property is disabled. Regardless of the value of TripleState, you cannot set the control to Null through the user interface.

When the TripleState property is True, a user can choose from the values of Null, True, and False. The null value is displayed as a shaded button.

When TripleState is False, the user can choose either True or False.

A control set to Null does not initiate the Click event.

Regardless of the property setting, the Null value can always be assigned programmatically to a CheckBox or ToggleButton, causing that control to appear shaded.


Value Property

Specifies the state or content of a given control.

Syntax

object.Value [= Variant]

The Value property syntax has these parts:

Part	Description
object	Required. A valid object.
Variant	Optional. The state or content of the control.
Settings

Control	Description
CheckBox	An integer value indicating whether the item is selected:
	Null   Indicates the item is in a null state, neither selected nor cleared.
	–1   True. Indicates the item is selected.
	0   False. Indicates the item is cleared.
OptionButton	Same as CheckBox.
ToggleButton	Same as CheckBox.
ScrollBar	An integer between the values specified for the Max and Min properties.
SpinButton	Same as ScrollBar.
ComboBox, ListBox	The value in the BoundColumn of the currently selected rows.
CommandButton	Always False.
MultiPage	An integer indicating the currently active page.
	Zero (0) indicates the first page. The maximum value is one less than the number of pages.
TextBox	The text in the edit region.
Remarks

For a CommandButton, setting the Value property to True in a macro or procedure initiates the button’s Click event.

For a ComboBox, changing the contents of Value does not change the value of BoundColumn. To add or delete entries in a ComboBox, you can use the AddItem or RemoveItem method.

For a TextBox, any value you assign to the Text property is also assigned to the Value property.

Value cannot be used with a multi-select list box.


Visible Property

Specifies whether an object is visible or hidden.

Syntax

object.Visible [= Boolean]

The Visible property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the object is visible or hidden.
Settings

The settings for Boolean are:

Value	Description
True	Object is visible (default).
False	Object is hidden.
Remarks

Use the Visible property to control access to information without displaying it. For example, you could use the value of a control on a hidden form as the criteria for a query.

All controls are visible at design time.


WordWrap Property

Indicates whether the contents of a control automatically wrap at the end of a line.

Syntax

object.WordWrap [= Boolean]

The WordWrap property syntax has these parts:

Part	Description
object	Required. A valid object.
Boolean	Optional. Whether the control expands to fit the text.
Settings

The settings for Boolean are:

Value	Description
True	The text wraps (default).
False	The text does not wrap.
Remarks

For controls that support the MultiLine property as well as the WordWrap property, WordWrap is ignored when MultiLine is False.


Add a control to a form

Use any of the following methods to add a control from the Control Toolbox to your form. You can also use these methods to insert a control in a Frame, TabStrip, or MultiPage on the form.

•	Click a control in the Control Toolbox and then click in the form. The control appears in its default size. You can then drag the border of the control to change its size.

•	Drag a control from the Control Toolbox to the form. The control appears in its default size.

•	Double-click the control in the Control Toolbox, and then click in the form once for each control you want to create. For example, to create four command buttons, double-click the CommandButton control in the Control Toolbox, and then click four times in the form.


About the Outlook script debugger

The Microsoft Script Debugger provides you with a comprehensive debugging environment for testing and correcting errors in the VBScript code for your Outlook forms. The Script Debugger is a shared component that can also be used to track down errors in any ActiveX-enabled scripting language and to debug Java applets, beans, and ActiveX components.

The Microsoft Script Debugger lets you debug both client scripts and server scripts.

The Microsoft Script Debugger works the way many debuggers do, by allowing you to:

•	View the source code of the script that you are debugging.

•	Control the pace of the script execution.

•	View and change variable and property values.

•	View and control script flow.

The Microsoft Script Debugger is available when you install Outlook 98. In the Outlook 98 Active Setup wizard, choose the Full Installation Option. This option contains Development Tools that include the script debugger.

If you have already installed Outlook 98 and your installation did not include the script debugger, it is available as a component installation. When you choose to install Outlook 98 Add-On Components, the Development Tools add-in contains Visuals for Forms Design, Microsoft Script Debugger, and Outlook Visual Basic Help.

Note  If the Script Debugger is not installed, the Script Debugger command under Forms on the Tools menu of an Outlook form will always be unavailable, or grayed.

To install the script debugger, check the Development Tools check box on the Microsoft Outlook 98 Component Install page. Click the NEXT> button at the bottom right-hand corner of the page. The next page will confirm the component that you are installing. Check to be certain that you are installing the Development Tools component. Click the Install Now button. When installation is complete, you must restart Windows so that the installation can finish.

You can also download the Microsoft Script Debugger from Microsoft on the Web at:

http://www.microsoft.com/scripting/

Note  The script debugger is only available in Outlook at run time.

For more information about using the script debugger in Outlook, click here


How to use the Outlook script debugger

To use the script debugger, open a form in design mode.

To add VBScript to the form, on the Form menu, click on View Code. In the Script Editor window, add the necessary VBScript for your form. For more information about adding VBScript to the form, click here

On the Tools menu, select Forms, click Run This Form.

While your form is in run mode, on the Tools menu, select Forms and click Script Debugger.

Note  If there is no VBScript for this form, the Script Debugger menu item will be unavailable.

The VBScript for this form will appear in a read-only window. You cannot change text in this window.

On the Help menu of the Microsoft Script Debugger, select Help Topics for more detailed information about:

•	Debugging scripts

•	Viewing source code

•	Controlling program execution

•	Viewing and changing values

•	Viewing and controlling program flow


About the Outlook object browser

The Outlook object browser displays the classes, properties, methods, events, and constants available from the Outlook 98 type library. The object browser lets you view and insert these objects into the Script Editor and obtain information about the syntax for using the object.

For more information about viewing and using the object browser, click here


How to use the Outlook object browser

To view the Outlook object browser:

1  Open a form in design mode.

2  In the Form menu, click View Code to view the Script Editor.

3  In the Script Editor, click Object Browser on the Script menu or press F2.

All of the available Outlook objects are listed in the Classes pane of the object browser in alphabetical order.

To view the members of an object, select the object in the Classes pane. The members of this object appear in alphabetical order in the Members of pane. The heading at the top of this pane will reflect the name of the object that you select. For example, if you select the AppointmentItem object in the Classes pane, the heading of the Members of pane will appear as Members of AppointmentItem.

The details pane shows the definition of the selected member. This text is read-only and cannot be copied and pasted into the Script Editor.

To insert an item from the object browser into the Script Editor:

1  In the Script Editor, position your cursor at the location for insertion.

2  Select the desired object in the Classes pane.

3  Select the desired member of this object in the Members of pane.

4  Click the Insert button.

 Note The Insert button remains unavailable until a member of the object is selected.


Set properties for controls

There are two types of properties for a control: Outlook properties and advanced properties. Outlook properties are the basic properties needed to design a control. Advanced properties offer additional functionality.

Outlook properties are set in the Properties dialog box, and must be set individually. Advanced properties are set in the Advanced Properties dialog box and can be set for multiple controls at once. To set properties for a control, right-click the control, and then click Properties on the shortcut menu. Select the options you want.

•	To set advanced properties for controls, select the controls you want, right-click one of the controls, and then click Advanced Properties on the shortcut menu. Select the options you want. For information about how to select multiple controls, click  [image].


Add Help to a form

Perform the following steps to add a page of explanatory text to your form.

1	Click the page you want to add text to.

2	On the Form menu, click Rename Page.

3	In the Page name box, type Help, and then click OK.

4	Drag a TextBox control from the Control Toolbox to the form.

5	Right-click the TextBox control, and then click Properties on the shortcut menu.

6	On the Display page, select Multi-line check box.

7	Type the explanatory text you want in the TextBox control.

8	Right-click the TextBox control, and then click Properties on the shortcut menu.

9	On the Display page, select the Read only check box.

Notes:

•	Because a Help file cannot be associated with a form, you cannot use the HelpContextId property to create Help for an Outlook Form.

•	If the Compose page is different from the Read page, you may need to create separate Help pages.


Assign a control tip, caption, and accelerator key to a control

1	Right-click the control you want, and then click Advanced Properties on the shortcut menu.

2	To set the property, click the property and enter a value in the Apply box.

To assign	Set the property
The string you want to use as the control tip	ControlTipText
The string you want to use as the caption	Caption
A single character as the value for ALT+Key entry. If you use a character from the caption of the control, the character is underlined	Accelerator
Note   You can also set the value of these properties with code. For example, to set the caption of the Label1 control on the Message page, use:

Item.GetInspector.ModifiedFormPages("Message").Label1.Caption = "New Caption"


Active controls and selected controls

In design mode, all controls have an active state and a selected state. When a control is active, it means you are working with the contents of the control; when a control is selected, it means you are working with the control itself.

Most controls are automatically selected when you put them on the form. In design mode, sizing handles appear around the control border when the control is selected. If you deselect the control, you can select it again by clicking the control.

Clicking a control that is selected puts the control in the active state. In this state, you can directly edit the control Caption or Value property, depending on the control.

In both the selected and the active state, you can use DEL, CTRL+X, and CTRL+C for the Delete, Cut, and Copy commands, respectively. In the selected state, these commands are available on the shortcut menu and affect the control itself. In the active state, these commands affect whatever text is selected inside the control; if no text is selected, these commands have no effect. These commands are not available on the shortcut menu for active controls.


Create a set of OptionButton controls

By default, all OptionButton controls in a container are part of a single option group. This means that selecting one of the buttons automatically sets all other option buttons on the page to False.

If you want more than one option group on the page, there are two ways to create additional groups:

•	Use the GroupName property to identify related buttons. This method reduces the number of controls required on the form, which can reduce the hard disk space required and improve the performance of the form. If you want to create an option group in a TabStrip (which is not a container), you must use the GroupName property.

•	Put related buttons in a page, MultiPage, or Frame on the form.

What do you want to do?

Create a set of OptionButtons using the GroupName property

Add a control to a form


Create a set of OptionButtons using the GroupName property

1	Place all required OptionButton controls on the form.

Note that option buttons in a Page, MultiPage, or Frame automatically form an option group.

2	For each button in the group, set the GroupName property to the same value.


Ways to protect sensitive information

Many applications use data that is for authorized users only. The following list suggests ways you can protect sensitive information in a form. Note however, that the fields associated with a form can still be exposed in a view.

•	Write code that makes a control (and its data) invisible to unauthorized users. To identify a particular user in code, use the following code.

Application.GetNameSpace("MAPI").CurrentUser

The Visible property makes a control visible or invisible.

•	Write code that sets the control foreground and background to the same color when unauthorized users run the application. This hides the information from unauthorized users. The ForeColor and BackColor properties determine the foreground color and the background color.

•	Disable the control when unauthorized users run the application. The Enabled property determines when a control is disabled.

•	Require a password to alter a form. For more information about setting passwords to protect a form, click here

•	Require a password for access to the application or a specific control. You can use placeholders as the user types each character. The PasswordChar property defines placeholder characters.

•	If the form only appears in a public folder, you can set permissions for the folder to determine who can open the form. For information, click  [image].

Note   Using passwords or any other techniques listed above can improve the security of your application, but these methods do not guarantee the prevention of unauthorized access to your data.


Set permissions in a folder

If you are the owner of a public folder, you can set permissions in the folder to give users the ability to perform certain functions. By adding the user names, distribution list names, or public folder names to the Name box on the Permissions page, you can determine who can:

•	Create items

•	Read items

•	Create subfolders

•	Edit items

•	Delete items

You can also determine who is the Folder owner and the Folder contact and to whom the Folder is visible.

To set permissions:

1	In the Folder list, right-click the public folder for which you want to set permissions and then click Properties on the shortcut menu. Note  The Properties tab is only available if the folder is a public folder.

2	Click the Permissions page.

3	Click the Add button to add a user name to the list. Choose a name from the Address Book and click OK.

4	Select the user’s name in the Name box for whom you want to alter permissions.

5	In the Roles box, choose the role for this user. The permissions check boxes will automatically revert to the default values for this role.

6	If you want to define a custom role, check the permissions check boxes that you require for this user. The value in the Roles box will change to “Custom”.

7	When you have set the Roles for all the users, click OK on the Properties page.

Note To remove a name, select the name and click Remove. You can remove any name from the Name box except Default.


Align text in a control

This procedure is only available for the ComboBox, Label, and TextBox controls.

1	Right-click the control you want, and then click Advanced Properties on the shortcut menu.

2	To set the TextAlign property, click the property and enter a value in the Apply box.

To	Set the TextAlign property to
Align the text with the left edge of the control	Left
Align the text with the right edge of the control	Right
Center the text relative to the length of the control	Center


Show the shortcut menu for controls and groups of controls

To show the shortcut menu for a	Right-click
page	the caption of the appropriate page.
MultiPage	anywhere in the control, but not on the caption of any page in the control.
Group of controls (groups created with the Group command)	anywhere inside the rectangle that surrounds the group.
tab	the caption of the appropriate tab.
TabStrip	anywhere in the control, but not on the caption of any tab in the control.
Any other control or container	the control or container.
Note   The commands on a shortcut menu vary based on the object you select. For example, if you select multiple controls that aren’t in a group, the shortcut menu includes the Group command; the shortcut menu for a text box does not include this command.


Change the appearance of a control

Outlook includes several properties you can use to define the appearance of controls in your form: ForeColor, BackColor, BackStyle, BorderColor, BorderStyle, and SpecialEffect.

•	ForeColor determines the foreground color. The foreground color applies to any text associated with the control, such as the caption or the control contents.

•	BackColor and BackStyle apply to the control background. The background is the area within the control boundaries, such as the area surrounding the text in a control, but not the control border. BackColor determines the background color. BackStyle determines whether the background is transparent. A transparent control background is useful if your form has a background picture.

For ForeColor and BackColor, you can use the color scheme defined by your system, or you can use a custom color that you pick from the color palette. Using a system color, such as Menu Text, ensures that your form matches the colors and palette used by your applications. Custom colors do not always appear the same across systems and screen resolutions, but they do offer the widest choice of colors.

•	BorderColor, BorderStyle, and SpecialEffect apply to the control border. You can use BorderStyle or SpecialEffect to choose a border type. Only one of these two properties can be used at a time. When you assign a value to one of these properties, the system sets the other property to None. With SpecialEffect, you can choose one of several border styles, but you can only use system colors for the border. BorderStyle supports only one border style, but you can choose any color that is a valid setting for BorderColor. BorderColor specifies the color of the control border and is only valid when you use BorderStyle to create the border.

Outlook supports transparency, the display of whatever is behind an object instead of its background, in two areas: the background of certain controls and in bitmaps used on certain controls.

You can show a bitmap on many controls. Certain controls support transparent bitmaps — that is, bitmaps in which one or more background colors are transparent. Bitmap transparency is not controlled by any control property; it is controlled by the color of the lower-left pixel in the image. Outlook does not provide a way to edit a bitmap and make it transparent; you must use a picture editor for this purpose.

Bitmaps are always transparent on the following controls: CheckBox, CommandButton, Label, OptionButton, and ToggleButton. In Outlook, the following do not support transparent bitmaps: the form, Frame control, Image control, and MultiPage control.

Transparent pictures sometimes have a hazy appearance. If you do not like this appearance, show the picture on a control that supports opaque images. If you use a transparent bitmap on a control that does not support transparent bitmaps, the bitmap appears correctly, but you can’t see what’s behind the bitmap.

What do you want to do?

Use a system color for a background or foreground

Use a custom color for the background or foreground of a control

Set the background color of a form

Make a control transparent


Make a control transparent

1	Right-click the control you want to make transparent, and then click Advanced Properties on the shortcut menu.

2	Set the BackStyle property to Transparent. To set the property, click the property and enter a value in the Apply box.

3	If the control supports the BorderStyle property, set it to None.

Note   When you make a control transparent, the background color does not appear, so the BackColor property is ignored. However, the setting for BackColor is not changed when a control is transparent. For information about transparency, click  [image].


Assign a picture to a control

1	Right-click the control you want to assign a picture to, and then click Advanced Properties on the shortcut menu.

2	Set the Picture property. To set the property, click the property and enter a value in the Apply box.

3	In the File name box, enter the name of the picture and its path.

Note   If the picture is larger than the control, Outlook scales the picture to fit the control.


Assign a picture to a form

1	Right-click the form, and then click Advanced Properties on the shortcut menu.

2	To set the property, click the property and enter a value in the Apply box.

Set the property	To the value
Picture	The name of the picture you want to use
PictureAlignment	TopLeft
PictureSizeMode	Clip
PictureTiling	True


Align a picture on a control

1	Right-click the control that has the bitmap you want to align, and then click Advanced Properties on the shortcut menu.

2	Set one or all of the following properties. To set the property, click the property and enter a value in the Apply box.

To	Set the property
Center the picture within the Image or align any corner of the picture with the corresponding corner of the Image.	PictureAlignment
Clip, stretch, or zoom the picture within the Image (stretching can distort the picture but zooming does not).	PictureSizeMode
Show multiple copies of the picture within the Image.	PictureTiling


Delete a picture from a control

1	Right-click the control, and then click Advanced Properties on the shortcut menu.

2	Highlight the value of the Picture property (the word “bitmap”).

3	Press DELETE.


Use a system color for a background or foreground

1	Right-click the control, and then click Properties on the shortcut menu.

2	Click an option in the Foreground color or Background color box.

A preview of the option that you select appears in the font box above.


Use a custom color for the background or foreground of a control

1	Right-click the control, and then click Advanced Properties on the shortcut menu.

2	Click the BackColor or ForeColor property.

3	In the top-right corner of the Properties dialog box, click the button with 3 dots.

4	Click the color you want from the color palette.


Set the background color of a form

1	Right-click the form, and then click Advanced Properties on the shortcut menu.

2	Set the BackColor property. To set the property, click the property and enter a value in the Apply box.


Create a list box

1	In design mode, drag the ListBox control from the Control Toolbox to the form.

2	Right-click the list box, and then click Advanced Properties on the shortcut menu.

3	To create a standard list box, set the ListStyle property to Plain. To set the property, click the property and enter a value in the Apply box.

To create a list box with option buttons or check boxes, set the ListStyle property to Option.

4	Fill the list at design time or run time.

How?

Note   When the ListStyle property is set to Option, the MultiSelect property determines whether check boxes or option buttons appear in the list. When MultiSelect is set to Single, option buttons appear in the list. When MultiSelect is set to Multi or Extended, check boxes appear in the list.


Match entries in a list to entries typed by users

1	In design mode, drag the ListBox or ComboBox control from the Control Toolbox to the form.

2	Right-click the list box or combo box, and then click Advanced Properties on the shortcut menu.

3	To set the MatchEntry property, click the property and enter a value in the Apply box.

To	Set the MatchEntry property to
Provide no matching	No matching
Compare the most recently typed letter to the first letter of each entry in the list (the first match in the list is selected)	First letter
Compare the user’s entry and an exact match in an entry from the list	Complete
Notes

•	The matching feature resets after 2 seconds (6 seconds in the Far East version). For example, if you have a list of the 50 United States you type “CO” quickly, you will find “Colorado.” But if you type “CO” in longer than 2 seconds, you will find “Ohio” because the auto-complete search resets between letters.

•	If you select Complete matching, it is a good idea to sort the list entries alphabetically (you can use the TextColumn property to do this). If the list is not sorted alphabetically, matching may not work correctly. For example, if the list includes Alabama, Louisiana, and Alaska, respectively, then “Alabama” is considered a complete match if the user types “ala.” In fact, this result is not complete because there are two entries in the list that could match what the user entered. Sorting alphabetically eliminates this.


Add items to a list

You can add items to a list box or a combo box at design time and at run time. A ListBox and a ComboBox control must be bound to a field. For information about how to bind fields to controls, click  [image].

What do you want to do?

Add items to a list at design time

Add items to a list at run time


Add items to a list at design time

1	In design mode, drag the ListBox or ComboBox control from the Control Toolbox to the form.

2	Right-click the control, and then click Properties on the shortcut menu.

3	On the Value page, click Choose Field, point to the User-defined field set, and then click the custom field to which you want the control bound.

4	In the Possible values box, type the values for the items, separated by semicolons, that you want to appear in the list.


Add items to a list at run time

In a ListBox or ComboBox with a single column, use the AddItem method to add an individual entry to the list. For information, click  [image].

In a multicolumn list box or combo box, you can use the List and Column properties to load the list from a two-dimensional array, as shown in the following steps.

1	Create a multicolumn ListBox or ComboBox control.

2	In Visual Basic Scripting Edition, create a two-dimensional array that contains the items you want to put in the list.

3	Set the ColumnCount property of the list box or combo box to match the number of entries in the list. To set the property, click the property and enter a value in the Apply box.

4	Do one of the following:

•	Assign the array as the value of  the List property. The contents of the list box will match the contents of the array exactly.

•	Assign the array as the value of the Column property. Column transposes rows and columns, so each row of the list box matches the corresponding column of the array.


Things you can do with a multicolumn ListBox or ComboBox

To control the column widths of a multicolumn ListBox or ComboBox, you can specify the width, in points, for all the columns in the ColumnWidths property. Specifying zero for a specific column hides that column of information.

If you want to hide all but one column of a ListBox or ComboBox from the user, you can identify the column of information to appear by using the TextColumn property.

Similarly, you can control which column of values is used for the control when the user makes a selection by specifying the column number in the BoundColumn property.


Add Method

Adds a control by its programmatic identifier (ProgID) to a page  or adds or inserts a Tab or Page in a TabStrip or MultiPage.

Syntax

For MultiPage, TabStrip
Set Object = object.Add( [ Name [,  Caption [,  index]]])

For other controls
Set Control = object.Add( ProgID [,  Name [,  Visible]])

The Add method syntax has these parts:

Part	Description
object	Required. A valid object name.
Name	Optional. Specifies the name of the object being added. If a name is not specified, the system generates a default name based on the rules of the application where the form is used.
Caption	Optional. Specifies the caption to appear on a tab or a control. If a caption is not specified, the system generates a default caption based on the rules of the application where the form is used.
index	Optional. Identifies the position of a page or tab within a Pages or Tabs collection. If an index is not specified, the system appends the page or tab to the end of the Pages or Tabs collection and assigns the appropriate index value.
ProgID	Required. Programmatic identifier. A text string with no spaces that identifies an object class. The standard syntax for a ProgID is <Vendor>.<Component>.<Version>. A ProgID is mapped to a class identifier (CLSID).
Visible	Optional. True if the object is visible (default). False if the object is hidden.
Settings

ProgID values for individual controls are:

CheckBox	Forms.CheckBox.1
ComboBox	Forms.ComboBox.1
CommandButton	Forms.CommandButton.1
Frame	Forms.Frame.1
Image	Forms.Image.1
Label	Forms.Label.1
ListBox	Forms.ListBox.1
MultiPage	Forms.MultiPage.1
OptionButton	Forms.OptionButton.1
ScrollBar	Forms.ScrollBar.1
SpinButton	Forms.SpinButton.1
TabStrip	Forms.TabStrip.1
TextBox	Forms.TextBox.1
ToggleButton	Forms.ToggleButton.1
Remarks

For a MultiPage control, the Add method returns a Page object. For a TabStrip, it returns a Tab object. The index value for the first Page or Tab of a collection is 0, the value for the second Page or Tab is 1, and so on.

For the Controls collection of an object, the Add method returns a control corresponding to the specified ProgID. The AddControl event occurs after the control is added.

The following syntax will return the Text property of a control added at design time:

userform1.thebox.text

If you add a control at run time, you must use the exclamation syntax to reference properties of that control. For example, to return the Text property of a control added at run time, use the following syntax:

userform1!thebox.text

Note  You can change a control's Name property at run time only if you added that control at run time with the Add method.


AddItem Method

For a single-column ListBox or ComboBox, the AddItem method adds an item to the list. For a multicolumn ListBox or ComboBox, this method adds a row to the list.

Syntax

Variant = object.AddItem( [ item [,  varIndex]])

The AddItem method syntax has these parts:

Part	Description
object	Required. A valid object.
Item	Optional. Specifies the item or row to add. The number of the first item or row is 0; the number of the second item or row is 1, and so on.
varIndex	Optional. Integer specifying the position within the object where the new item or row is placed.
Remarks

If you supply a valid value for varIndex, the AddItem method places the item or row at that position within the list. If you omit varIndex, the method adds the item or row at the end of the list.

The value of varIndex must not be greater than the value of the ListCount property.

For a multicolumn ListBox or ComboBox, AddItem inserts an entire row, that is, it inserts an item for each column of the control. To assign values to an item beyond the first column, use the List or Column property and specify the row and column of the item.

If the control is bound to data, the AddItem method fails.

Note  You can add more than one row at a time to a ComboBox or ListBox by using List.


Clear Method

Removes all objects from an object or collection.

Syntax

object.Clear

The Clear method syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

For a MultiPage or TabStrip, the Clear method deletes individual pages or tabs.

For a ListBox or ComboBox, Clear removes all entries in the list.

For a Controls collection, Clear deletes controls that were created at run-time with the Add method. Using Clear on controls created at design-time causes an error.

If the control is bound to data, the Clear method fails.


Copy Method

Copies the contents of an object to the Clipboard.

Syntax

object.Copy

The Copy method syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

The original content remains on the object.

The actual content that is copied depends on the object. For example, on a Page, the Copy method copies the currently selected control or controls. On a TextBox or ComboBox, it copies the currently selected text.

Using Copy for a form, Frame, or Page copies the currently-active control.


Cut Method

Removes selected information from an object and transfers it to the Clipboard.

Syntax

object.Cut

The Cut method syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

For a ComboBox or TextBox, the Cut method removes currently selected text in the control to the Clipboard. This method does not require that the control have the focus.

On a Page, Frame, or form, Cut removes currently selected controls to the Clipboard. This method only removes controls created at run time.


DropDown Method

Displays the list portion of a ComboBox.

Syntax

object.DropDown

The DropDown method syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

Use the DropDown method to open the list in a combo box.


GetFormat Method

Returns an integer value indicating whether a specific format is on the DataObject.

Syntax

Boolean = object.GetFormat( format)

The GetFormat method syntax has these parts:

Part	Description
object	Required. A valid object.
format	Required. An integer or string specifying a specific format that might exist in the DataObject. If the specified format exists in the DataObject, GetFormat returns True.
Settings

The settings for format are:

Value	Description
1	Text format.
A string or any integer other than 1	A user-defined DataObject format passed to the DataObject from SetText.
Remarks

The GetFormat method searches for a format in the current list of formats on the DataObject. If the format is on the DataObject, GetFormat returns True; if not, GetFormat returns False.

The DataObject currently supports only text formats.


GetFromClipboard Method

Copies data from the Clipboard to a DataObject.

Syntax

String = object.GetFromClipboard( )

The GetFromClipboard method syntax has these parts:

Part	Description
object	Required. A valid object name.
Remarks

The DataObject can contain multiple data items, but each item must be in a different format. For example, the DataObject might include one text item and one item in a custom format; but cannot include two text items.


GetText Method

Retrieves a text string from the DataObject using the specified format.

Syntax

String = object.GetText( [ format])

The GetText method syntax has these parts:

Part	Description
object	Required. A valid object name.
format	Optional. A string or integer specifying the format of the data to retrieve from the DataObject.
Settings

The settings for format are:

Value	Description
1	Text format.
A string or any integer other than 1	A user-defined DataObject format passed to the DataObject from SetText.
Remarks

The DataObject supports multiple formats, but only supports one data item of each format. For example, the DataObject might include one text item and one item in a custom format; but cannot include two text items.

If no format is specified, the GetText method requests information in the Text format from the DataObject.


Item Method

Returns a member of a collection, either by position or by name.

Syntax

Set Object = object.Item(  collectionindex)

The Item method syntax has these parts:

Part	Description
object	Required. A valid object.
collectionindex	Required. A member's position, or index, within a collection.
Settings

The collectionindex can be either a string or an integer. If it is a string, it must be a valid member name. If it is an integer, the minimum value is 0 and the maximum value is one less than the number of items in the collection.

Remarks

If an invalid index or name is specified, an error occurs.


Move Method

Moves a form or control, or moves all the controls in the Controls collection..

Syntax

For a form or control
object.Move( [Left [,  Top [,  Width [,  Height [,  Layout]]]]])

For the Controls collection
object.Move( X, Y)

The Move method syntax has these parts:

Part	Description
object	Required. A valid object name.
Left	Optional. Single-precision value, in points, indicating the horizontal coordinate for the left edge of the object.
Top	Optional. Single-precision value, in points, that specifies the vertical coordinate for the top edge of the object.
Width	Optional. Single-precision value, in points, indicating the width of the object.
Height	Optional. Single-precision value, in points, indicating the height of the object.
Layout	Optional. A Boolean value indicating whether the Layout event is initiated for the control's parent following this move. False is the default value.
X, Y	Required. Single-precision value, in points, that specifies the change from the current horizontal and vertical position for each control in the Controls collection.
Settings

The maximum and minimum values for the Left, Top, Width, Height, X, and Y arguments vary from one application to another.

Remarks

For a form or control, you can move a selection to a specific location relative to the edges of the form that contains the selection.

You can use named arguments, or you can enter the arguments by position. If you use named arguments, you can list the arguments in any order. If not, you must enter the arguments in the order shown, using commas to indicate the relative position of arguments you do not specify. Any unspecified arguments remain unchanged.

For the Controls collection, you can move all the controls in this collection a specific distance from their current positions on a form, Frame, or Page.


Paste Method

Transfers the contents of the Clipboard to an object.

Syntax

object.Paste

The Paste method syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

Data pasted into a ComboBox or TextBox is treated as text.

When the paste method is used with a form, you can paste any object onto the form.


PutInClipboard Method

Moves data from a DataObject to the Clipboard.

Syntax

object.PutInClipboard

The PutInClipboard method syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

The PutInClipboard method replaces the contents of the Clipboard with the contents of the DataObject that is in Text format.


RedoAction Method

Reverses the effect of the most recent Undo action.

Syntax

Boolean = object.RedoAction

The RedoAction method syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

Redo reverses the last Undo, which is not necessarily the last action taken. Not all actions can be undone.

For example, after pasting text into a TextBox and then choosing the Undo command to remove the text, you can choose the Redo command to put the text back in.

RedoAction returns True if it was successful.


Remove Method

Removes a member from a collection; or, removes a control from a Frame, Page, or form.

Syntax

object.Remove(  collectionindex)

The Remove method syntax has these parts:

Part	Description
object	Required. A valid object.
collectionindex	Required. A member's position, or index, within a collection. Numeric as well as string values are acceptable. If the value is a number, the minimum value is zero, and the maximum value is one less than the number of members in the collection. If the value is a string, it must correspond to a valid member name.
Remarks

This method deletes any control that was added at run time. However, attempting to delete a control that was added at design time will result in an error.


RemoveItem Method

Removes a row from the list in a list box or combo box.

Syntax

Boolean = object.RemoveItem(  index)

The RemoveItem method syntax has these parts:

Part	Description
object	Required. A valid object.
index	Required. Specifies the row to delete. The number of the first row is 0; the number of the second row is 1, and so on.
This method will not remove a row from the list if the ListBox is data bound(that is, when the RowSource property specifies a data source for the ListBox).


Repaint Method

Updates the display by redrawing the form or page.

Syntax

Boolean = object.Repaint

The Repaint method syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

The Repaint method is useful if the contents or appearance of an object changes significantly, and you don't want to wait until the system automatically repaints the area.


Scroll Method

Moves the scroll bar on an object.

Syntax

object.Scroll( [ ActionX [,  ActionY]])

The Scroll method syntax has these parts:

Part	Description
object	Required. A valid object name.
ActionX	Optional. Identifies the action to occur in the horizontal direction.
ActionY	Optional. Identifies the action to occur in the vertical direction.
Settings

The settings for ActionX and ActionY are:

Value	Description
0	Do not scroll in the specified direction.
1	Move up on a vertical scroll bar or left on a horizontal scroll bar. Movement is equivalent to pressing the up or left arrow key on the keyboard to move the scroll bar.
2	Move down on a vertical scroll bar or right on a horizontal scroll bar. Movement is equivalent to pressing the right or down arrow key on the keyboard to move the scroll bar.
3	Move one pageup on a vertical scroll bar or one page left on a horizontal scroll bar. Movement is equivalent to pressing PAGE UP on the keyboard to move the scroll bar.
4	Move one pagedown on a vertical scroll bar or one page right on a horizontal scroll bar. Movement is equivalent to pressing PAGE DOWN on the keyboard to move the scroll bar.
5	Move to the top of a vertical scroll bar or to the left end of a horizontal scroll bar.
6	Move to the bottom of a vertical scroll bar or to the right end of a horizontal scroll bar.
Remarks

The Scroll method applies scroll bars that appear on a form, Frame, or Page that is larger than its display area. This method does not apply to the stand-alone ScrollBar or to scroll bars that appear on a TextBox.


SetDefaultTabOrder Method

Sets the TabIndex property of each control on a form, using a default top-to-bottom, left-to-right tab order.

Syntax

object.SetDefaultTabOrder

The SetDefaultTabOrder method syntax has these parts:

Part	Description
object	Required. A valid object.


SetFocus Method

Moves the focus to this instance of an object.

Syntax

object.SetFocus

The SetFocus method syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

If setting the focus fails, the focus reverts to the previous object and an error is generated.

By default, setting the focus to a control does not activate the control's window or place it on top of other controls.

The SetFocus method is valid for an empty Frame as well as a Frame that contains other controls. An empty Frame will take the focus itself, and any subsequent keyboard events apply to the Frame. In a Frame that contains other controls, the focus moves to the first control in the Frame, and subsequent keyboard events apply to the control that has the focus.


SetText Method

Copies a text string to the DataObject using a specified format.

Syntax

object.SetText(  StoreData [,  format])

The SetText method syntax has these parts:

Part	Description
object	Required. A valid object.
StoreData	Required. Defines the data to store on the DataObject.
format	Optional. An integer or string specifying the format of StoreData. When retrieving data from the DataObject, the format identifies the piece of data to retrieve.
Settings

The settings for format are:

Value	Description
1	Text format.
A string or integer value other than 1	A user-defined DataObject format.
Remarks

The DataObject stores data according to its format. When the user supplies a string, the DataObject saves the text under the specified format.

If the DataObject contains data in the same format as new data, the new data replaces the existing data in the DataObject. If the new data is in a new format, the new data and the new format are both added to the DataObject, and the previously existing data is there as well.

If no format is specified, the SetText method assigns the Text format to the text string. If a new format is specified, the DataObject registers the new format with the system.


StartDrag Method

Initiates a drag-and-drop operation for a DataObject.

Syntax

DropEffect=Object.StartDrag([Effect as DropEffect])

The StartDrag method syntax has these parts:

Part	Description
Object	Required. A valid object.
Effect	Optional. Effect of the drop operation on the target control.
Settings

The settings for Effect are:

Value	Description
0	Does not copy or move the drop source to the drop target.
1	Copies the drop source to the drop target.
2	Moves the drop source to the drop target.
3	Copies or moves the drop source to the drop target.
Remarks

The drag action starts at the current mouse pointer position with the current keyboard state and ends when the user releases the mouse. The effect of the drag-and-drop operation depends on the effect chosen for the drop target.

For example, a control’s MouseMove event might include the StartDrag method. When the user clicks the control and moves the mouse, the mouse pointer changes to indicate whether Effect is valid for the drop target.


UndoAction Method

Reverses the most recent action that supports the Undo command.

Syntax

Boolean = object.UndoAction

The UndoAction method syntax has these parts:

Part	Description
object	Required. A valid object.
Remarks

The Undo command in the user interface uses the UndoAction method. For example, if you paste text into a TextBox, you can use UndoAction to remove that text and restore the previous contents of the TextBox.

Not all user actions can be undone. If an action cannot be undone, the Undo command is unavailable following the action.

If UndoAction is applied to a form, all changes to the current record are lost. If UndoAction is applied to a control, only the control itself is affected.

You must apply this method before the form or control is updated. You may want to include this method in a form's PropertyChange event.


ZOrder Method

Places the object at the front or back of the z-order.

Syntax

object.ZOrder( [ zPosition])

The ZOrder method syntax has these parts:

Part	Description
object	Required. A valid object.
zPosition	Optional. A control's position, front or back, in the container's z-order.
Settings

The settings for zPosition are:

Value	Description
0	Places the control at the front of the z-order. The control appears on top of other controls (default).
1	Places the control at the back of the z-order. The control appears underneath other controls.
Remarks

The z-order determines how windows and controls are stacked when they are presented to the user. Items at the back of the z-order are overlaid by closer items; items at the front of the z-order appear to be on top of items at the back. When the zPosition argument is omitted, the object is brought to the front.

In design mode, the Bring to Front or Send To Back commands set the z-order. Bring to Front is equivalent to using the ZOrder method and putting the object at the front of the z-order. Send to Back is equivalent to using ZOrder and putting the object at the back of the z-order.

This method does not affect content or sequence of the controls in the Controls collection.

Note   You can't Undo or Redo layering commands, such as Send to Back or Bring to Front. For example, if you select an object and click Move Backward on the shortcut menu, you won't be able to Undo or Redo that action.


Visual Basic Scripting Edition and Visual Basic for Applications in Outlook

You can extend the functionality of Outlook Forms by using Microsoft Visual Basic Scripting Edition (VBScript), which is a subset of Visual Basic for Applications. Outlook does not host Visual Basic for Applications (VBA).

You can access an information store by using Outlook objects through Automation (formerly known as OLE Automation). You do this by writing Visual Basic for Applications code in Microsoft Excel, Microsoft Access, Word, or PowerPoint.

Code written for Visual Basic for Applications often does not work in VBScript without modification. For example, you must replace all built-in constants written in VBA with the literal numeric values of those constants in VBScript.

For a list of all the constant values, click  [image].

In Visual Basic Scripting Edition, when you reference the Application object to use CreateObject or GetObject, you simply use Application. For example, the following code opens the Tasks folder:

Set olMAPI = Application.GetNameSpace(“MAPI”)

Set myItem = olMAPI. (13)

For more information about the Outlook object model from within the Outlook Forms Environment, click  [image].


Constants and variables in Visual Basic Scripting Edition

Constants must be referenced by their numeric values. The constant string does not work and returns a value of 0, which gives unpredictable results.

For a list of all the constant values, click  [image].

There are two types of variables. Procedure-level variables that are used only within a procedure and  script-level variables that are available to all the procedures within your script. Declare script-level variables at the top of your script. Declare procedure-level variables inside procedures. You can use procedure-level variables with the same name in different procedures because each variable is recognized only by the procedure in which it’s declared. When the procedure exits, the variable ends.

Rules about variables:

•	Must begin with an alphanumeric character.

•	Cannot contain an embedded period.

•	Cannot exceed 255 characters.

•	Cannot use more than 127 procedure-level variables (arrays count as a single variable).

•	Cannot use GetDefaultFolder more than 127 script-level variables.


Variants supported in Visual Basic Scripting Edition

Microsoft Visual Basic Scripting Edition in Outlook uses only the Variant data type.

A Variant is a special kind of data type that can contain different kinds of information, depending on how it's used. Because Variant is the only data type in VBScript, it's also the data type returned by all functions in VBScript.

At its simplest, a Variant can contain either numeric or string information. A Variant behaves as a number when you use it in a numeric context and as a string when you use it in a string context. That is, if you're working with data that looks like numbers, VBScript assumes that it is numbers and does the thing that is most appropriate for numbers. Similarly, if you're working with data that can only be string data, VBScript treats it as string data. Of course, you can always make numbers behave as strings by enclosing them in quotation marks (" ").


Copy a form to another forms library

1	On the Tools menu, click Options, and then click the Other tab.

2	Click the Advanced Options button.

3	Click the Custom Forms button.

4	Click the Manage Forms button.

3	To change the forms library, click Set.

4	In the box on the left, click the form you want to copy to the forms library shown in the box on the right.

To copy a form to a Folder Forms Library or to an Organization Forms Library, you must have appropriate permission.

5	Click Copy.

Note   When you copy a form from your Personal Forms Library to a Folder Forms Library or to an Organization Forms Library, you must change the name or a property of the form. Outlook only updates the forms in your Personal Forms Library if the form from the Folder Forms or Organization Forms Library has different properties.


Operator summary

Operators can be used to combine and extend the functions included with Outlook.

Arithmetic operators

Comparison operators

Concatenation operators

Logical operators


Arithmetic operators

^ operator

* operator

/ operator

\ operator

Mod operator

+ operator

- operator


Comparison operators

Used to compare expressions.

Syntax

result = expression1 comparisonoperator expression2

result = string Like pattern

Comparison operators have these parts:

Part	Description
expression	Any expression.
comparisonoperator	Any comparison operator.
string	Any string expression.
pattern	Any string expression or range of characters.
Remarks

The Like operator has specific comparison functionality that differs from the operators in the following table.  The following table contains a list of the comparison operators and the conditions that determine whether result is True, False, or Null:

Operator	Description	True if	False if	Null if
<	Less than	expression1 < expression2	expression1 >= expression2	expression1 or expression2 = Null
<=	Less than or equal to	expression1 <= expression2	expression1 > expression2	expression1 or expression2 = Null
>	Greater than	expression1 > expression2	expression1 <= expression2	expression1 or expression2 = Null
>=	Greater than or equal to	expression1 >= expression2	expression1 < expression2	expression1 or expression2 = Null
=	Equal to	expression1 = expression2	expression1 <> expression2	expression1 or expression2 = Null
<>	Not equal to	expression1 <> expression2	expression1 = expression2	expression1 or expression2 = Null
When comparing two expressions, you may not be able to easily determine whether the expressions are being compared as numbers or as strings.  The following table shows how the expressions are compared or what results when either expression is not a Variant:

If	Then
Both expressions are numeric data types (Byte, Boolean, Integer, Long, Single, Double, Date, or Currency)	Perform a numeric comparison.
Both expressions are String	Perform a string comparison.
One expression is a numeric data type and the other is a Variant that is, or can be, a number	Perform a numeric comparison.
One expression is a numeric data type and the other is a string Variant that can't be converted to a number	Perform a string comparison.
One expression is a String and the other is any Variant (except a Null)	Perform a string comparison.
One expression is Empty and the other is a numeric data type	Perform a numeric comparison, using 0 as the Empty expression.
One expression is Empty and the other is a String	Perform a string comparison, using a zero-length string ("") as the Empty expression.
If expression1 and expression2 are both Variant expressions, their underlying type determines how they are compared.  The following table shows how the expressions are compared or what results from the comparison, depending on the underlying type of the Variant:

If	Then
Both Variant expressions are numeric	Perform a numeric comparison.
Both Variant expressions are strings	Perform a string comparison.
One Variant expression is numeric and the other is a string	The numeric expression is less than the string expression.
One Variant expression is Empty and the other is numeric	Perform a numeric comparison, using 0 as the Empty expression.
One Variant expression is Empty and the other is a string	Perform a string comparison, using a zero-length string as the Empty expression.
Both Variant expressions are Empty	The expressions are equal.
Note   If a Currency is compared with a Single or Double, the Single or Double is converted to a Currency.  This causes any fractional part of the Single or Double value less than 0.0001 to be lost and may cause two values to compare as equal when they are not.  When a Single is compared to a Double, the Double is rounded to the precision of the Single.


Concatenation operators

& operator

+ operator


Logical operators

And operator

Eqv operator

Imp operator

Not operator

Or operator

Xor operator


Operator precedence

When several operations occur in an expression, each part is evaluated and resolved in a predetermined order called operator precedence.

When expressions contain operators from more than one category, arithmetic operators are evaluated first, comparison operators are evaluated next, and logical operators are evaluated last.  Comparison operators all have equal precedence; that is, they are evaluated in the left to right order in which they appear.  Arithmetic and logical operators are evaluated in the following order of precedence:

Arithmetic	Comparison	Logical
Exponentiation (^)	Equality (=)	Not
Negation (-)'	Inequality (<>)	And
Multiplication and division (*, /)	Less than (<)	Or
Integer division (\)	Greater than (>)	Xor
Modulo arithmetic (Mod)	Less than or equal to (<=)	Eqv
Addition and subtraction (+, -)	Greater than or equal to (>=)	Imp
String concatenation (&)	Like
When multiplication and division occur together in an expression, each operation is evaluated as it occurs from left to right.  Likewise, when addition and subtraction occur together in an expression, each operation is evaluated in order of appearance from left to right.

The string concatenation operator (&) is not an arithmetic operator, but in precedence it does follow all arithmetic operators and before all comparison operators.  Similarly, the Like operator, while equal in precedence to all comparison operators, is actually a pattern-matching operator.

Parentheses can be used to override the order of precedence and force some parts of an expression to be evaluated before others.  Operations within parentheses are always performed before those outside.  Within parentheses, however, operator precedence is maintained.


^ operator

Used to raise a number to the power of an exponent.

Syntax

result = number^exponent

The ^ operator syntax has these parts:

Part	Description
result	Any numeric variable.
number	Any numeric expression.
exponent	Any numeric expression.
Remarks

Number can be negative only if exponent is an integer value.  When more than one exponentiation is performed in a single expression, the ^ operator is evaluated as it is encountered from left to right.

Usually, the data type of result is a Double or a Variant containing a Double.  However, if either number or exponent is a Null expression, then result is Null.


+ operator

Used to sum two numbers.

Syntax

result = expression1+expression2

The + operator syntax has these parts:

Part	Description
result	Any numeric variable.
expression1	Any expression.
expression2	Any expression.
Remarks

Use the & operator for concatenation to eliminate ambiguity and provide self-documenting code.

When you use the + operator, you may not be able to determine whether addition or string concatenation will occur.  If at least one expression is not a Variant, the following rules apply:

If	Then
Both expressions are numeric data types (Byte, Boolean, Integer, Long, Single, Double, Date, or Currency)	Add.
Both expressions are String	Concatenate.
One expression is a numeric data type and the other is any Variant except Null	Add.
One expression is a String and the other is any Variant except Null	Concatenate.
One expression is an Empty Variant	Return the remaining expression unchanged as result.
One expression is a numeric data type and the other is a String	A Type mismatch error occurs.
Either expression is Null	result is Null.
If both expressions are Variant expressions, the following rules apply:

If	Then
Both Variant expressions are numeric	Add.
Both Variant expressions are strings	Concatenate.
One Variant expression is numeric and the other is a string	Add.
For simple arithmetic addition involving only expressions of numeric data types, the data type of result is usually the same as that of the most precise expression.  The order of precision, from least to most precise, is Byte, Integer, Long, Single, Double, and Currency.  The following are exceptions to this order:

•	When a Single and a Long are added together, the data type of result is converted to a Double.

•	When the data type of result is a Long, Single, or Date variant that overflows its legal range, result is converted to a Double variant.

•	When the data type of result is a Byte variant that overflows its legal range, result is converted to an Integer variant.

•	When the data type of result is an Integer variant that overflows its legal range, result is converted to a Long variant.

•	When a Date is added to any data type, the data type of result is always a Date.

Note   The order of precision used by addition and subtraction is not the same as the order of precision used by multiplication.

If one or both expressions are Null expressions, result is Null.  If both expressions are Empty, result is an Integer.  However, if only one expression is Empty, the other expression is returned unchanged as result.


- operator

Used to find the difference between two numbers or to indicate the negative value of a numeric expression.

Syntax 1

result = number1-number2

Syntax 2

-number

The - operator syntax has these parts:

Part	Description
result	Any numeric variable.
number	Any numeric expression.
number1	Any numeric expression.
number2	Any numeric expression.
Remarks

In Syntax 1, the - operator is the arithmetic subtraction operator used to find the difference between two numbers.  In Syntax 2, the - operator is used as the unary negation operator to indicate the negative value of an expression.

The data type of result is usually the same as that of the most precise expression.  The order of precision, from least to most precise, is Byte, Integer, Long, Single, Double, Currency.  The following are exceptions to this order:

•	When subtraction involves a Single and a Long, the data type of result is converted to a Double.

•	When the data type of result is a Long, Single, or Date variant that overflows its legal range, result is converted to a Variant containing a Double.

•	When the data type of result is a Byte variant that overflows its legal range, result is converted to an Integer variant.

•	When the data type of result is an Integer variant that overflows its legal range, result is converted to a Long variant.

•	When subtraction involves a Date and any other data type, the data type of result is a Date.

•	When subtraction involves two Date expressions, the data type of result is Double.

Note   The order of precision used by addition and subtraction is not the same as the order of precision used by multiplication.

If one or both expressions are Null expressions, result is Null.  If an expression is Empty, it is treated as 0.


* operator

Used to multiply two numbers.

Syntax

result = number1*number2

The * operator syntax has these parts:

Part	Description
result	Any numeric variable.
number1	Any numeric expression.
number2	Any numeric expression.
Remarks

The data type of result is usually the same as that of the most precise expression.  The order of precision, from least to most precise, is Byte, Integer, Long, Single, Currency, Double.  The following are exceptions to this order:

•	When multiplication involves a Single and a Long, the data type of result is converted to a Double.

•	When the data type of result is a Long, Single, or Date variant that overflows its legal range, result is converted to a Variant containing a Double.

•	When the data type of result is a Byte variant that overflows its legal range, result is converted to an Integer variant.

•	When the data type of result is an Integer variant that overflows its legal range, result is converted to a Long variant.

Note   The order of precision used by multiplication is not the same as the order of precision used by addition and subtraction.

If one or both expressions are Null expressions, result is Null.  If an expression is Empty, it is treated as 0.


/ operator

Used to divide two numbers and return a floating-point result.

Syntax

result = number1/number2

The / operator syntax has these parts:

Part	Description
result	Any numeric variable.
number1	Any numeric expression.
number2	Any numeric expression.
Remarks

The data type of result is usually a Double or a Double variant.  The following are exceptions to this rule:

•	When both expressions are Byte, Integer, or Single expressions, result is a Single unless it overflows its legal range; in which case, an error occurs.

•	When both expressions are Byte, Integer, or Single variants, result is a Single variant unless it overflows its legal range; in which case, result is a Variant containing a Double.

If one or both expressions are Null expressions, result is Null.  Any expression that is Empty is treated as 0.


\ operator

Used to divide two numbers and return an integer result.

Syntax

result = number1\number2

The \ operator syntax has these parts:

Part	Description
result	Any numeric variable.
number1	Any numeric expression.
number2	Any numeric expression.
Remarks

Before division is performed, the numeric expressions are rounded to Byte, Integer, or Long expressions.

Usually, the data type of result is a Byte, Byte variant, Integer, Integer variant, Long, or Long variant, regardless of whether result is a whole number.  Any fractional portion is truncated.  However, if any expression is Null, result is Null.  Any expression that is Empty is treated as 0.


Mod operator

Used to divide two numbers and return only the remainder.

Syntax

result = number1 Mod number2

The Mod operator syntax has these parts:

Part	Description
result	Any numeric variable.
number1	Any numeric expression.
number2	Any numeric expression.
Remarks

The modulus, or remainder, operator divides number1 by number2 (rounding floating-point numbers to integers) and returns only the remainder as result.  For example, in the following expression, A (which is result) equals 5.

A = 19 Mod 6.7

Usually, the data type of result is a Byte, Byte variant, Integer, Integer variant, Long, or Variant containing a Long, regardless of whether or not result is a whole number.  Any fractional portion is truncated.  However, if any expression is Null, result is Null.  Any expression that is Empty is treated as 0.


& operator

Used to force string concatenation of two expressions.

Syntax

result = expression1 & expression2

The & operator syntax has these parts:

Part	Description
result	Any String or Variant variable.
expression1	Any expression.
expression2	Any expression.
Remarks

If an expression is not a string, it is converted to a String variant.  The data type of result is String if both expressions are String expressions; otherwise, result is a String variant. If both expressions are Null, result is Null.  However, if only one expression is Null, that expression is treated as a zero-length string ("") when concatenated with the other expression.  Any expression that is Empty is also treated as a zero-length string.


And operator

Used to perform a logical conjunction on two expressions.

Syntax

result = expression1 And expression2

The And operator syntax has these parts:

Part	Description
result	Any numeric variable.
expression1	Any expression.
expression2	Any expression.
Remarks

If both expressions evaluate to True, result is True.  If either expression evaluates to False, result is False.  The following table illustrates how result is determined:

If expression1 is	And expression2 is	The result is
True	True	True
True	False	False
True	Null	Null
False	True	False
False	False	False
False	Null	False
Null	True	Null
Null	False	False
Null	Null	Null
The And operator also performs a bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table:

If bit in expression1 is	And bit in expression2 is	The result is
0	0	0
0	1	0
1	0	0
1	1	1


Eqv operator

Used to perform a logical equivalence on two expressions.

Syntax

result = expression1 Eqv expression2

The Eqv operator syntax has these parts:

Part	Description
result	Any numeric variable.
expression1	Any expression.
expression2	Any expression.
Remarks

If either expression is Null, result is also Null.  When neither expression is Null, result is determined according to the following table:

If expression1 is	And expression2 is	The result is
True	True	True
True	False	False
False	True	False
False	False	True
The Eqv operator performs a bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table:

If bit in expression1 is	And bit in expression2 is	The result is
0	0	1
0	1	0
1	0	0
1	1	1


Imp operator

Used to perform a logical implication on two expressions.

Syntax

result = expression1 Imp expression2

The Imp operator syntax has these parts:

Part	Description
result	Any numeric variable.
expression1	Any expression.
expression2	Any expression.
Remarks

The following table illustrates how result is determined:

If expression1 is	And expression2 is	The result is
True	True	True
True	False	False
True	Null	Null
False	True	True
False	False	True
False	Null	True
Null	True	True
Null	False	Null
Null	Null	Null
The Imp operator performs a bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table:

If bit in expression1 is	And bit in expression2 is	The result is
0	0	1
0	1	1
1	0	0
1	1	1


Not operator

Used to perform logical negation on an expression.

Syntax

result = Not expression

The Not operator syntax has these parts:

Part	Description
result	Any numeric variable.
expression	Any expression.
Remarks

The following table illustrates how result is determined:

If expression is	Then result is
True	False
False	True
Null	Null
In addition, the Not operator inverts the bit values of any variable and sets the corresponding bit in result according to the following table:

Bit in expression	Bit in result
0	1
1	0


Or operator

Used to perform a logical disjunction on two expressions.

Syntax

result = expression1 Or expression2

The Or operator syntax has these parts:

Part	Description
result	Any numeric variable.
expression1	Any expression.
expression2	Any expression.
Remarks

If either or both expressions evaluate to True, result is True.  The following table illustrates how result is determined:

If expression1 is	And expression2 is	The result is
True	True	True
True	False	True
True	Null	True
False	True	True
False	False	False
False	Null	Null
Null	True	True
Null	False	Null
Null	Null	Null
The Or operator also performs a bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table:

If bit in expression1 is	And bit in expression2 is	The result is
0	0	0
0	1	1
1	0	1
1	1	1


Xor operator

Used to perform a logical exclusion on two expressions.

Syntax

[result =] expression1 Xor expression2

The Xor operator syntax has these parts:

Part	Description
result	Optional.  Any numeric variable.
expression1	Required.  Any expression.
expression2	Required.  Any expression.
Remarks

If one, and only one, of the expressions evaluates to True, result is True.  However, if either expression is Null, result is also Null.  When neither expression is Null, result is determined according to the following table:

If expression1 is	And expression2 is	The result is
True	True	False
True	False	True
False	True	True
False	False	False
The Xor operator performs as both a logical and bit-wise operator. A bit-wise comparison of two expressions using exclusive-or logic to form the result, as shown in the following table:

If bit in expression1 is	And bit in expression2 is	The result is
0	0	0
0	1	1
1	0	1
1	1	0


Like operator

Used to compare two strings.

Syntax

result = string Like pattern

The Like operator syntax has these parts:

Part	Description
result	Any numeric variable.
String	Any string expression.
pattern	Any string expression conforming to the pattern-matching conventions described in Remarks.
Remarks

If string matches pattern, result is True; if there is no match, result is False; and if either string or pattern is Null, result is Null.

The behavior of the Like operator depends on a sort order derived from the internal binary representations of the characters. In Microsoft Windows, sort order is determined by the code page.  In the following example, a typical binary sort order is shown:

A < B < E < Z < a < b < e < z < À < Ê < Ø < à < ê < ø

Built-in pattern matching provides a versatile tool for string comparisons.  The pattern-matching features allow you to use wildcard characters, character lists, or character ranges, in any combination, to match strings.  The following table shows the characters allowed in pattern and what they match:

Characters in pattern	Matches in string
?	Any single character.
*	Zero or more characters.
#	Any single digit (0 – 9).
[charlist]	Any single character in charlist.
[!charlist]	Any single character not in charlist.
A group of one or more characters (charlist) enclosed in brackets ([ ]) can be used to match any single character in string and can include almost any character code, including digits.

Note   To match the special characters left bracket ([), question mark (?), number sign (#), and asterisk (*), enclose them in brackets.  The right bracket (]) can't be used within a group to match itself, but it can be used outside a group as an individual character.

By using a hyphen (-) to separate the upper and lower bounds of the range, charlist can specify a range of characters .  For example, [A-Z] results in a match if the corresponding character position in string contains any of the uppercase letters in the range A through Z.  Multiple ranges are included within the brackets without delimiters.

The meaning of a specified range depends on the character ordering valid at run time.  Using the same example shown above, the range [A – E] matches A, B, and E.

Other important rules for pattern matching include the following:

•	An exclamation point (!) at the beginning of charlist means that a match is made if any character except the ones in charlist is found in string.  When used outside brackets, the exclamation point matches itself.

•	The hyphen (-) can appear either at the beginning (after an exclamation point if one is used) or at the end of charlist to match itself.  In any other location, the hyphen is used to identify a range of characters.

•	When a range of characters is specified, they must appear in ascending sort order (from lowest to highest).  [A-Z] is a valid pattern, but [Z-A] is not.

•	The character sequence [] is considered a zero-length string.

In some languages, there are special characters in the alphabet that represent two separate characters.  For example, several languages use the character "æ" to represent the characters "a" and "e" when they appear together.  The Like operator recognizes that the single special character and the two individual characters are equivalent.

When a language that uses a special character is specified in the system locale settings, an occurrence of the single special character in either pattern or string matches the equivalent 2-character sequence in the other string.  Similarly, a single special character in pattern enclosed in brackets (by itself, in a list, or in a range) matches the equivalent 2-character sequence in string.


Create an Outlook form

Note  All custom forms must be based on existing Outlook forms. If you do not wish to use the default form functionality provided by Outlook, you can hide all of the default form pages and use only the extra blank pages to create a complete custom form. For information about hiding form pages, click here

To begin designing a form:

1	Open an Outlook item. This can be accomplished by various methods. For example, to open a new mail message item, you can:

•	Click on the New Mail Message icon to open a mail message.

•	Click on the arrow beside the New Mail Message icon and click on Mail Message.

•	Select New on the File menu and click on Mail Message.

•	Select New Mail Message on the Actions menu.

•	Double-click anywhere in an empty area of the Inbox view pane.

2	When you have the new form opened, on the Tools menu of the form, select Forms and click Design This Form. You may also click Design Form and choose to design a different form.

3	Add the fields, controls, and code that you want to your new form.

Note   If you want to use Visual Basic Scripting Edition to extend the controls and fields see Using Microsoft Visual Basic Scripting Edition under Outlook Forms Help on the Help Contents tab or click here

For information about how to create a form using an Office document, click here


Design Outlook Workgroup Solutions

With Microsoft Outlook, you can create a variety of workgroup solutions and forms. You can create workgroup solutions by using custom views in a public folder. You can also create simple forms with no programming involved or create advanced forms by using custom controls, properties, and Visual Basic Scripting Edition (VBScript). You can also use another Office program to create a form.

There are four basic approaches to creating Outlook solutions. You can use existing items, such as tasks or appointment items, put the items in a public folder, and assign a view to the folder. This method gives you an instant workgroup solution without writing any code. Another method is to modify an existing item, such as a contact or mail message, by adding additional pages and fields. With this method, you can extend the use of the item by adding the fields and pages you need without writing any code. To create advanced forms, you can use the Control Toolbox and VBScript to access properties, events, methods, and objects within Outlook. You can also use Office document forms, such as using Microsoft Excel to create an expense report.

What method do you want to use?

Create an instant workgroup solution using public folders

Extend the use of an Outlook item by adding additional fields and pages

Create custom forms by using Visual Basic Scripting Edition

Create forms by using Office documents


Create an instant workgroup solution using public folders

By using custom views in a public folder, you can take an existing item, such as a contact, and turn it into a workgroup form that any user of the public folder can get information from or add data to. With this method, you create an appointment, task, or contact in a public folder, create a custom view for the information in the folder, and then give permission to those you want to use the folder.

To see a sample of a workgroup form in a folder, click  [image].

Click a step below to begin:

Step 1: Create a public folder

Step 2: Create an Outlook item in a public folder

Step 3: Create and use a custom view in a public folder

Step 4: Give permissions to those you want to use the folder


Step 1: Create a public folder

To create a public folder, you must have permission to create folders in an existing public folder. For information about how to obtain permission, see your administrator.

1	On the File menu, select New, and then click Folder. (Ctrl+Shift+E)

2	In the Name box, enter a name for the folder.

3	In the Folder contains box, click the type of item you want the folder to contain. A folder can only contain one type of item.

4	In the Select where to place the folder box, click the public folder you want your new public folder to appear in.

6	If you do not want to add a Shortcut for the public folder to your Outlook Bar, click No in the Add shortcut to Outlook Bar? box.

Note   You can copy a private folder to a public folder for quick creation of a public folder with existing items. For information about how to copy a folder, click  [image].

To go on to Step 2, click  [image].


Step 2: Create an Outlook item in a public folder

1	If the public folder you want to use does not exist, you can create it.

How?

2	In the Folder List or on the Outlook Bar, select the public folder in which you want to add the new item.

3	On the File menu, point to New, and then click the item you want to create.

Tip   To quickly let others add the public folder to their Public Folders folder, you can send a shortcut in a mail message. For information about how to send a public folder shortcut in a mail message, click  [image].

To go on to Step 3, click  [image].


Sample of instant workgroup solution

In this example, a customer list is put in a public folder that is shared by sales managers. The view is customized so the contacts are grouped by categories for easy scanning and sorted by business phone so the phone numbers with the same area codes appear together. Sales managers can easily add new contacts or select existing contacts that they want to call.


Step 3: Create and use a custom view in a public folder

With custom views, you can arrange information in a public folder exactly how you want it. You can set which view is initially shown when a user opens the public folder, and you can remove all the standard views from a public folder and only show the custom views you create. By setting the permission for a public folder, you can determine who has access to the folder.

What do you want to do?

Create a custom view

Change the default view for a public folder

Show only the custom views in a folder

Restrict who uses the public folder


Change the default view in a public folder

To change the default view for a public folder, you must have owner permission for the folder, and there must be at least one custom view defined that is visible to everyone for the folder.

1  If the Folder List is not visible, click the View menu, and then click Folder List.

2  Click Public Folders, and then right-click the public folder you want to change the default view for.

3  Click Properties on the shortcut menu.

4  Click the Administration tab.

Note  If the Administration tab does not appear, you don’t have owner permission.

5  In the Initial view on folder box, enter the view that you want to appear each time the folder is opened. The Normal view displays the default Outlook view for the type of items in the folder.


Show only the custom views in a folder

1	On the View menu, select Current View, click Define Views.

2	Select the Only show views created for this folder check box.


Extend the use of an Outlook item by adding additional fields and pages

In this approach, you take a standard Outlook item, such as a contact or a mail message, and add fields and extra pages.

To see a sample of how an existing item can be modified, click  [image].

Note  All custom forms must be based on existing Outlook forms. If you do not wish to use the default form functionality provided by Outlook, you can hide all of the default form pages and use only the extra blank pages to create a complete custom form. For information about hiding form pages, click here

1	Open the item on which you want to base the form. For example, if you want your form to organize and collect information about a person or organization, open a contact. In the contact, select Forms on the Tools menu and click Design This Form. This opens the item in design mode.
2	Design the form by moving, removing, and adding fields and pages in the form. All the fields in the form and all the fields you add from the Field Chooser retain their built-in properties and functionality. For procedures on designing form pages, see Creating Forms under Solutions with Forms, Public Folders, and Views on the Help Contents tab.
3	Set attributes for the form. In design mode, you add attributes such as a caption, password, or description on the Properties page. The Actions page lists default Reply forms. You can add your own custom Reply forms to the Actions page as well as change several aspects of how the default Reply forms work. For more information about how to set form attributes, click  [image].
4	Test and publish your form. You can instantly see how your form looks; just open your new form in run mode by clicking Run This Form on the Tools, Forms menu in the form. You can publish your form to your Personal Forms Library or to a folder to test it, and then publish the form to a public folder or to the Organization Forms Library so other users can use it. For more information about how to save a form to a forms library, click  [image].


Save and distribute a form

There are three ways to save a form that you have created.

•	Save the form in the open folder. Use this option when you want to send a form to others by using e-mail or you do not plan to share the form.

•	Save the form as a file. Use this option when you want to work with the form in another program or you want to save the form as a template; you do not plan to share the form with others or you want to send the form to others by using e-mail.

•	Save the form in a forms library. Use this option when you want to save a form to a location (library) for easy access. There are three forms libraries.

•	Personal Forms Library. Forms saved in this library are accessible to only you and are stored in your mailbox. These forms are available on the item menu from the Choose Form command. Use this library when you have created a form for your own personal use, such as a form to track mileage.

•	Outlook Folders. Forms saved in this library can be accessible to everyone (in a public folder) or only to you (in a private folder). If the form is saved in a library on your hard disk, it is accessible to you only while in the folder. These forms are available on the item menu while you are in the folder. Use this library when saving forms to a specific folder, generally a public folder. For example, in a customer tracking public folder, you could have a meeting report form and a customer profile form.

•	Organizational Forms Library. Forms saved in this library are accessible to everyone in your organization and are stored on the server. (You must have write permission to save to the server; for information, see your administrator.) These forms are available on the item menu from the Choose Form command. Use this library when you want to make the form available to everyone in your organization, such as a form to report vacation time. Saving to this library provides a quick and easy way to distribute and update forms.


Sample of a custom form based on an existing item

In the sample below, the form designer has created a new page on a mail message called Contact and created some Outlook fields to gather information. The First, Last, and Phone fields are custom fields created by clicking New in the Field Chooser. The form is pre-addressed to a particular folder so that contacts can automatically be added to a list and then sorted, categorized, and filtered. The Created field at the bottom automatically adds the date and time the contact is sent. The Message page is hidden in run mode so the user cannot address the form to someone else. As the sales staff uses the form to record contacts, they are sent to a folder that has a view applied that groups the contacts by category and then sorts them by the Created field. In this way, a sales manager has instant access to up-to-the-minute contact information.


Set the attributes of a form

The attributes of a form are set in design mode on the Properties and Actions pages. On the Properties page, the information such as Description, Category, and Form Number helps users find and identify your form in the New Form dialog box. If you do not want users to modify your form, you can protect a form by assigning a password to it.

One very important attribute of your form is whether to send the form definition with the form. The form definition includes all the fields and the code you add to the form. If you do not plan to publish your form to a forms library, then you must select the Send form definition with item check box (Properties page). The form definition includes all the new data you add to the form when you send the form to another user. If you plan to publish your form to a forms library to which other users have access, such as an Organization Forms Library or a public folder library, you do not need to send the form definition; it is stored in the library. The form definition can add considerable size to your form.

If you want to change how users reply to your form, click the Actions page. The Actions page lists the default Reply forms that are available. You can add your own custom Reply forms as well. For example, forms based on a new mail message have built-in Reply, Reply to All, Forward, and Reply to Folder forms. When users receive your form, the form will have buttons and menu commands so users can respond to the form. You can disable some or all of these default forms and set attributes for how these Reply forms appear.

For procedures on how to set the default attributes of a form, see Creating Forms under Outlook Forms on the Help Contents tab.


Test and publish your forms

When your form is ready, you should test the form to make sure it works. You can test the form in run mode, then publish the form to a folder or your Personal Forms Library, and open it to see how it works. Send the form to yourself to check the Reply actions, and then publish the form to a public folder or to your Organization Forms Library for others to use. You can also save a form to use in e-mail or as a template.

What do you want to do?

Test a form in run mode

Publish a form


Publish a form

1	On the Tools menu, select Forms and click Publish Form As.

2	In the Form Name box, type the name for the form.

3	To change the location (library) where the form is stored, select the folder that you want in the Look In box or click the Browse button.

4	Click the Publish button.


How to open a form

You can open custom forms that you create in Outlook. How you open a custom form depends on where you saved it. You can also open sample forms that are supplied with Outlook.

To open a form	Do this
In the Folder Forms Library	In the folder that you saved the form in, click the form you want on the item menu.
In the Organizational Forms Library	On the item menu, in File, select New and click Choose Form. (Click Organizational Forms Library in the box above if necessary.) To see forms grouped by categories, select the Show categories check box.
In the Personal Forms Library	On the item menu, in File, select New and click Choose Form. (Click Personal Forms Library in the box above if necessary.) To see forms grouped by categories, select the Show categories check box.
Saved as an Outlook template	On the item menu, in File, select New and click Choose Form. (Click Templates in File System in the box above if necessary.) To see templates grouped by categories, select the Show categories check box.
Saved as a file	On the Tools menu, click Find. In the Find pane, click Advanced Find.In the Look for box, click Files(Outlook/Exchange) and then type the name of the file in the Named box.
In the Standard Forms Library	On the item menu, in File, select New and click Choose Form. (Click Standard Forms Library in the box above if necessary.) To see forms grouped by categories, select the Show categories check box.


Test a form in run mode

To switch between the design mode and the run mode (as it appears when used) of the form, select Forms on the Tools menu and click Run This Form.

Note   You can test the form outside the Outlook design environment. Open a new instance of the form. For information, click  [image]. Enter information in the form, send or post it, and then open the form to make sure it appears correctly. If the form is not correct, you can make changes to it. For information about how to edit a form, click


How to edit a form

1	Open the form.

How?

2	On the Tools menu, select Forms and click Design This Form to switch to the design mode of the page.

3	Make your changes.

4	Save the form.

How?


Hide or show form pages

While in design mode:

1	Click the page you want to hide or show.

2	On the Form menu, click Display This Page to clear or select the check mark.

Notes

•	Parentheses around a page name indicate the page is hidden. You cannot show the (Properties) or (Actions) pages.

•	If you drag a field or control to a hidden page, the page automatically shows.

•	To change what appears on the default or first page of an item, hide the first page, and then create a new version on one of the custom pages.

•	At least one page must be visible in a form.


Create custom forms by using Visual Basic Scripting Edition

Microsoft Visual Basic Scripting Edition (VBScript) is a subset of Visual Basic for Applications (VBA). You can use VBScript to create procedures that control Outlook folders, objects, items, and properties. Visual Basic Scripting Edition in Outlook requires a special object syntax that has some differences from referencing objects in VBA. For more information about the Outlook object model, click here  [image].

You can extend Outlook forms by using custom controls from the Control Toolbox. Outlook forms can use most of the properties and methods that come with the controls. Since controls cannot store values, to store the value you need to bind the control to an Outlook field. For more information about binding, click here

The Outlook object browser displays the classes, properties, methods, events, and constants available from the Outlook 98 type library. The object browser lets you view and use objects in the Script Editor and obtain information about the syntax for using the object. For more information about viewing and using the object browser, click here

The Microsoft Script Debugger provides you with a comprehensive debugging environment for testing and correcting errors in the VBScript for your forms. For more information about the script debugger, click here

For a full explanation of VBScript in Outlook, including a description and samples of the Outlook object model, see Using Microsoft Visual Basic Scripting Edition with Outlook Forms under Outlook Forms on the Help Contents tab.

The Microsoft Outlook Web site has additional materials and up-to-the-minute details about programming Outlook Forms. On the Help menu, click Microsoft on the Web, and then click Product News.

For a basic introduction to VBScript and a reference manual, see the Visual Basic Scripting Edition Web site at:

http://www.microsoft.com/vbscript/


Create forms by using Office documents

Office documents can be used as forms in Outlook although you will not be able to create custom form pages.

To open an Office document as a form:

1  Point to New on the File menu, and then click Office Document.

2  Double-click the type of document you want to use.

3  In the message box, select Post the document in this folder if you want to open the document as a post item or select Send the document to someone if you want to open the document as a mail item.

You can design and layout any type of form that meets your needs using the features of the program. For example, you can create a simple custom form, in which users simply fill in empty cells, using Microsoft Excel. Or you can use all the macros and Visual Basic controls in the program to create a more advanced custom form. You can set the form properties and actions, or publish the form to a forms library by selecting Forms on the Tools menu and clicking Design This Form. Once you open an Office document as a form, you must use the program Help command on the Help menu (for example, if you open a Word document, click Microsoft Word Help on the Help menu).


Select the item on which to base a form

Each Outlook item is a collection of fields. Some of these collections of fields may be more useful for particular applications than others. To see the complete list of fields for an item, click All in the Field Chooser. For example, to see all the fields in a mail message, click All Mail Fields. If the field you want is not listed, you can create a custom field by clicking New in the Field Chooser.

Use this item	To
Mail Message	Send a form to other people with an associated Reply form so they can send information back.
Post	Send a form to a folder.
Appointment or Meeting Request	Record scheduling information about people, dates, places, and times for an appointment or meeting.
Online Meeting Request	Record scheduling information about people, dates, times, and settings for an online NetMeeting conference.
Contact	Record information about a person or organization.
Task or Task Request	Record a personal or work-related duty or errand that you want to track through completion.
Journal Entry	Record interactions with important contacts, record items or documents that are significant to you, and record activities of all types.


Use fields with controls

When you drag a field from the Field Chooser, the field automatically binds to the appropriate control. If you want to save a value to or from a control that you create from the Control Toolbox, you need to bind the control to a field. In most cases, you bind TextBox, CheckBox, ListBox, ComboBox, and OptionButton controls to fields. Other controls, such as Label and Image controls, that contain static information with which the user does not interact are generally not bound to a field.

To bind a control to a field, right-click the control, and then click Properties on the shortcut menu. Click the Values tab. Click the Choose Field button, and then select a field or click the New button to create a custom field. Outlook fields are based on MAPI properties. In this way, the values of fields are stored with the item when you save or send the item. The controls from the Control Toolbox are only the visual containers for a field on a form. You can set the appearance of the control using its properties, but you cannot save a value. Controls only exist when the specific form appears that contains the controls. Fields can be used on any form. If you change a field value in one place, this value changes everywhere the field is used.

For example, to change the value of a custom field called Fax, you use the following code:

Item.UserProperties.Find(“Fax”).Value = “555-1234”

Note that since this is a field, you do not need to specify the page or the control the field is bound to. In the following code example, a control called txtFax is made invisible. When you work with a control, you must specify the page and the control name.

Item.GetInspector.ModifiedFormPages(“General”).(“txtFax”).Visible = False.

You can bind a control to a field at run time by using the internal property named ItemProperty. The following example binds a TextBox to a field named Business Address.

Item.GetInspector.ModifiedFormPages(“General”).Textbox1.ItemProperty = “Business Address”.


Set tab order of controls on a page

1	In design mode, right-click on a page in a form, but not on a control, and then click Tab Order on the shortcut menu.

2	Select the name of a control you want to reposition in the tab order.

3	Click Move Up or Move Down.

Note   You can also set the tab order by changing the TabIndex property. The tab index of the first control in the tab order is 0; the tab index of the second control is 1, and so on.


Should I use a MultiPage or a TabStrip?

If you use a single layout for data, use a TabStrip, and then map each set of data to its own tab. If you need several layouts for data, use a MultiPage, and then assign each layout to its own page.

Unlike a page of a MultiPage, the client region of a TabStrip is not a separate form but a portion of the form that contains the TabStrip. The border of a TabStrip defines a region of the form that you can associate with the tabs. When you place a control in the client region of a TabStrip, you are adding a control to the form that contains the TabStrip.


Assign a control tip, caption, and accelerator key to a page or tab

This procedure sets properties on a page or tab in a MultiPage or TabStrip control only.

1	In design mode, select a page or tab in a MultiPage or TabStrip control.

How?

Be sure to select an individual page or tab, not the corresponding MultiPage or TabStrip. When a page or tab is selected, a rectangle appears around its caption.

2	Right-click the selected page or tab, and then click Rename on the shortcut menu.

3	In the Control Tip Text box, type the string you want to use as the control tip.

In the Caption box, type the string you want to use as the caption.

In the Accelerator Key box, type a single character. Use a character from the caption of the control. Note that the selected character is underlined in the control caption.

Tip   To assign a control tip for a MultiPage or TabStrip, use the ControlTipText property. If you assign a control tip to a MultiPage or a TabStrip, control tips for the individual page or tab objects within the MultiPage do not appear.


Change the order of pages in a MultiPage or TabStrip

This procedure sets properties on a page or tab only in a MultiPage or TabStrip control.

1	In design mode, select any page in the MultiPage or TabStrip control.

How?

2	Right-click the caption of the page, and then click Move on the shortcut menu.

3	In the Page Order box, click the page you want to move.

4	Click Move Up or Move Down.

Note   You can also change the page order by changing the Index property. The index of the first page is 0; the index of the second page is 1, and so on.


Show or hide fields when printing and saving a form

1	In design mode, right-click the field you want, and then click Properties on the shortcut menu.

2	Click the Validation page.

3	Select or clear the Include this field for Printing and Save As check box.


Validate user input to a control
Validate user input to a field

You can require that any field, or any control that is bound to a field, have a value. For example, you can set the exact text, range of numbers, or any other criteria for the field. You can also show a custom message (based on a validation formula) that tells users how to fill in the field if their entries do not match the value you want. For example, you can limit the number of characters that can be entered in a TextBox. For examples of validation formulas, click [image].

What do you want to do?

Require a value for a field or control

Create a validation formula and message


Require a value for a field or control

1	In design mode, right-click the field or control you want, and then click Properties on the shortcut menu.

2	Click the Validation page.

3	Select the A value is required for this field check box.


Create a validation formula and message

1	In design mode, right-click the field or control you want to create a validation formula for, and then click Properties on the shortcut menu.

2	Click the Validation page.

3	Select the Validate this field before closing the form check box.

4	In the Validation Formula box, enter the formula you want to use for evaluating user input.

5	In the Display this message if the validation fails box, type the text you want to appear in the message.


Examples of validation formulas

To evaluate	Use
Numbers less than fifty	<50
Numbers greater than fifty	>50
Equal to fifty	=50
The number of characters	?


Allow multiple lines of text in a control

1	In design mode, right-click the control you want, and then click Properties on the shortcut menu.

2	On the Display page, select the Multi-line check box.

The following code example The following code example uses the ModifiedFormPages property of the current Inspector object to set the multi-line property of a TextBox on a page called “Test.”

Item.GetInspector.ModifiedFormPages(“Test”).Textbox1.MultiLine = True


Give a control a 3-D appearance

1	In design mode, right-click the control you want, and then click Advanced Properties on the shortcut menu.

2	Click SpecialEffect, and then click the option you want in the box above.

The following code example The following code example uses the ModifiedFormPages property of the current Inspector object to set the SpecialEffect property of a CheckBox on a page named “Test.”

Item.GetInspector.ModifiedFormPpages(“Test”).Checkbox1.SpecialEffect = 2

Note   For a list of available special effects, click  [image].


Make a control read-only

1	In design mode, right-click the control you want, and then click Properties on the shortcut menu.

2	On the Display page, select the Read only check box.

The following code example The following code example uses the ModifiedFormPages property of the current Inspector object to make TextBox1 read-only.

Item.GetInspector.ModifiedFormPages("P.2").TextBox1.ReadOnly = True


Enable or disable a control on a page

1	In design mode, right-click the control you want, and then click Properties on the shortcut menu.

2	On the Display page, select or clear the Enabled check box.

The following code example uses the ModifiedFormPages property of the current Inspector object to set the Enabled property of a CheckBox on a page named “Test.”

Item.GetInspector.ModifiedFormPages(“Test”).Checkbox1.Enabled = False


Hide or show a control

1	In design mode, right-click the control you want, and then click Properties on the shortcut menu.

2	On the Display page, select or clear the Visible check box.

The following code example The following code example uses the ModifiedFormPages property of the current Inspector object to set the Visible property of a CheckBox on a page named “Test.”

Item.GetInspector.ModifiedFormPages(“Test”).Checkbox1.Visible = False


Move a control one unit at a time

1	In design mode, right-click the control you want, and then click Properties on the shortcut menu.

2	On the Display page, type a number in the Top and Left boxes.


Change the name property of a control

1	In design mode, right-click the control you want, and then click Properties on the shortcut menu.

2	On the Display page, type a name in the Name box.

Note   Each control should have a unique name.

The following code example The following code example uses the ModifiedFormPages property of the current Inspector object to set the Name property of a CheckBox on a page named “Test” to “Selection.”

Item.GetInspector.ModifiedFormPages(“Test”).Checkbox1.Name = “Selection”


Use Microsoft Word in the message box of your form
Use Microsoft Word in the message control of your form

1	In design mode, click the Properties page.

2	Select the Always use Microsoft Word as the e-mail editor check box.

3	Enter the name of the template you want to use in the box below, or click Template to select from a list.


Change the icons associated with your form

1	In design mode, click the Properties page.

2	Click Change Large Icon or Change Small Icon.

3	Select the icon you want to use.


Protect your form from changes

1	In design mode, click the Properties page.

2	Select the Protect form design check box.

3	In the Password box, enter a password.

4	In the Confirm box, enter the same password again.


Send the form definition with the form

1	In design mode, click the Properties page.

2	Select the Send form definition with item check box.

Note   For more information about form definitions click,  [image].


About the Rules Wizard in Forms Help

The Rules Wizard add-in is not installed on this computer. For information about the Rules Wizard, point to Microsoft on the Web (Help menu), and then click Free Stuff.

For information about how to use the Inbox Assistant to create rules, click  [image].


About Outlook Forms Help

For more information about how to use forms to create an Outlook workgroup solution, click Microsoft Outlook Forms Help on the Help menu.


Create a form

Outlook includes items based on built-in forms (Outlook Forms). For example, mail messages are based on the New Message form, and contacts are based on the New Contact form. You can modify the built-in form that any item is based on to create your own form. Create a form from an item to provide the functionality of that item in your form.

You can also create a form from an Office file. For example, you can use Microsoft Excel to create an expense report form or Word to create a monthly status report form. These forms can be saved as templates, which are often used to make items look the same — for example, to customize a mail message for several clients. Create a form from an Office file to add the functionality of other Office programs to your form or change the appearance of an item.

For more information about forms, see Building Microsoft Outlook 97 Applications. For information about how to obtain this Microsoft Press book, click  [image].

What do you want to do?

Create a form from an Outlook item

Create a form from an Office file


Create a form from an Outlook item

1	Open the item you want to base the form on.

2	On the Tools menu, click Design Outlook Form.

3	Customize pages on the form.

How?

4	Hide or show pages on the form.

How?

5	Set properties on the (Properties) page.

How?

6	Create custom actions, such as responses for the form.

How?

7	Save and distribute the form.

How?

8	Test the form.

How?


Create a form from an Office file

This procedure requires that you are in an Outlook folder for items or a public folder, not a file folder.

1	On the File menu, point to New, and then click Office Document.

2	Double-click the icon for the type of file you want to start.

3	To create a form that you can post to a public or private folder and that contains only a Document page, click Post the document in this folder.

To create a form that you can send and that contains Document, Message, and Options pages, click Send the document to someone.

4	On the Tools menu, click Design Outlook form.

5	Hide or show pages on the form.

How?

6	Set properties on the (Properties) page.

How?

7	Create custom actions, such as responses for the form.

How?

8	Save and distribute the form.

How?

9	Test the form.

How?


Set properties for a control

1	Right-click the control, and then click Properties on the shortcut menu.

2	To bind the control to a field or to set initial and calculated values, click the Value page, and then select the options you want.

The Value and Validation pages do not appear for the MultiPage control.

For Help on an option, click the question mark  [image]  and then click the option.

3	To set font and format properties, click the Display page, and then select the options you want.

4	To set field validation settings and formulas, click the Validation page, and then select the options you want.

5	Click OK.

6	To set additional display properties, right-click the control, and then click Advanced Properties on the shortcut menu.


Hide or show pages on a form

1	Click the page you want to hide or show.

2	On the Form menu, click Display This Page to clear or select the check mark.

Notes

•	Parentheses around a page name indicate the page is hidden. You cannot show the (Properties) or (Actions) pages.

•	If you drag a field or control to a hidden page, the page automatically shows.

•	To change what appears on the default or first page of an item, hide the first page, and then create a new version on one of the custom pages.


Customize pages on a form

In general, you can customize up to five pages on a form. For mail messages and posts, you can customize a sixth page: the Message page.

1	Click the page you want to customize.

2	From the Field Chooser, drag a field to the page. The AutoLayout feature automatically sizes the field for you.

If the field you want doesn't appear in the Field Chooser, click a different field set in the box at the top of the Field Chooser.

3	To align, size, or remove fields, right-click the field, and then select the options you want on the shortcut menu.

4	Add and remove controls.

How?

Tips

•	To create fields, click New in the Field Chooser. Type a name for the field in the Name box, and then select a field type and format. Fields support calculated expressions, validation formulas, and field formatting. For more information about how to create fields, click  [image].

•	If you drag a field or control to a hidden page, the page automatically shows on the form.


Save and distribute a form

There are three ways to save a form you create.

•	Save the form in the open folder. Use this option when you want to send a form to others by using e-mail or you do not plan to share the form.

•	Save the form as a file. Use this option when you want to work with the form in another program or you want to save the form as a template; you do not plan to share the form with others or you want to send the form to others by using e-mail.

•	Save the form in a forms library. Use this option when you want to save a form to a location (library) for easy access. There are three forms libraries.

•	Personal Forms Library. Forms saved in this library are accessible to only you and are stored in your mailbox. These forms are available on the item menu from the Choose Form command. Use this library when you have created a form for your own personal use, such as a form to track mileage.

•	Folder Forms Library. Forms saved in this library can be accessible to everyone (in a public folder) or only to you (in a private folder). If the form is saved in a library on your hard disk, it is accessible to you only while in the folder. These forms are available on the item menu while you are in the folder. Use this library when saving forms to a specific folder, generally a public folder. For example, in a customer tracking public folder, you could have a meeting report form and a customer profile form.

•	Organization Forms Library. Forms saved in this library are accessible to everyone in your organization and are stored on the server. (You must have write permission to save to the server; for information, see your administrator.) These forms are available on the item menu from the Choose Form command. Use this library when you want to make the form available to everyone in your organization, such as a form to report vacation time. Saving to this library provides a quick and easy way to distribute and update forms.

If you want to save a form under a different name, open the form, and then click the Properties page. Type the new name in the Form caption box, and then save the form.

You can move sample forms into a forms library. Open the sample form, and then save it in a forms library by using the Publish Form As command on the File menu.

What do you want to do?

Save a form in the open folder

Save a form as a file

Save a form in a forms library

Send a form to others by using e-mail


Send a form to others by using e-mail

1	On the (Properties) tab in the form, select the Save form definition with item check box.

2	If you have not already done so, save the form in the open folder.

How?

3	Close the form, and then create a mail message.

4	On the Insert menu, click Item, and then click the form you want to insert.

5	Click OK, and then click Send  [image].

Tips

•	You can send a form to others outside your organization if the gateways or connectors support attachments in Rich Text Format.

•	In a mail message, the Save form definition with item check box is on by default. In all other items this option is off by default.


Save a form in a forms library

1	On the File menu, click Publish Form As.

2	In the Form Name box, type the name for the form.

3	To change the location (library) where the form is stored, click Publish in.

4	To save the form in the Organization Forms Library, click Organization in the Forms Library box.

To save the form in the Folder Forms Library, click Folder Forms Library, and then click the folder where you want the form saved.


Save a form as a file

1	On the File menu, click Save As.

2	In the File name box, type a name for the form.

3	In the Save as type box, click a file type.

To save the form as an Outlook template, click Outlook Template, and then save the form in the Templates folder.


Save a form in the open folder

•	On the File menu, click Save  [image].


Test the form

•	To switch between the design view and the read view (as it appears when used) of the form, click Design Outlook Form on the Tools menu.

Note   You can test the form outside the Outlook Forms designer. Open a new instance of the form. For information, click  [image]. Enter information in the form, send or post it, and then open the form to make sure it appears correctly. If the form is not correct, you can make changes to it. For information about how to edit a form, click  [image].


Add or remove controls on a form

1	To add a control, click Control Toolbox  [image], and then drag the control to the form.

2	Set control properties.

How?

3	To remove a control, right-click the control, and then click Delete on the shortcut menu.


Open a form

You can open custom forms that you create in Outlook. How you open a custom form depends on where you saved it. You can also open sample forms that are supplied with Outlook.

To open a form	Do this
In the Folder Forms Library	In the folder you saved the form in, click the form you want on the item menu.
In the Organization Forms Library	On the item menu, click Choose Form. (Click Organization in the box above if necessary.) To see forms grouped by categories, select the Show categories check box.
In the Personal Forms Library	On the item menu, click Choose Form. (Click Personal Form in the box above if necessary.) To see forms grouped by categories, select the Show categories check box.
Saved as an Outlook template	On the item menu, click Choose Template.
Saved as a file	On the Tools menu, click Find Items. In the Look for box, click Files, and then type the name of the file in the Named box.
That is a sample form supplied in Outlook	On the item menu, click Choose Template.


Make separate compose and read versions for a form

You can create and edit separate compose and read versions for each page of a form. The compose version is what the sender sees — for example, what you see when you create a message. The read version is what the recipient sees — for example, what you see when you read your mail.

1	To create or edit the compose page, click Edit Compose Page on the Form menu.

To create or edit the read page, click Edit Read Page on the Form menu.

2	Customize pages on the form.

How?

Note   You can quickly switch between the two versions by clicking the Edit Compose Page and Edit Read Page buttons on the Form Design toolbar. If these buttons are not available, you set compose and read versions to be the same. To have separate compose and read versions, click Separate Read Layout on the Form menu.


Create custom actions for a form

1	Click the (Actions) page.

2	Click New.

3	Select the options you want.

For Help on an option, click the question mark  [image]  and then click the option.

Notes

•	You can specify whether you want an action to appear as a command on both the item menu of the form and the Form Design toolbar, or just on the item menu.

•	You can use actions to open other forms, even forms of a different type. For example, you can create a message form with an action that opens a contact form.

•	You can also use actions to create new items. For example, you can create a message form with an action that creates a new contact. The new item is created in the open folder, not in the Contacts folder.


About forms

A form is an easy way to distribute and collect information electronically. For example, a form can be available for anyone to order supplies or post information in a public folder. Microsoft Outlook provides built-in forms such as the New Message form to compose messages and the New Contact form to enter information for a contact. If you have sent an e-mail message or created an appointment, you have used a form. Every Outlook item is based on a form.

You use the Outlook Forms designer to create custom forms either from an item (based on a built-in form) or from an Office file. Use a built-in form to leverage functionality from the item associated with it — for example, to include automatic name checking in a custom form, create it from a form based on a mail message. To modify a form, you can add and remove fields, controls, options, and tabs. You can use an Office file to incorporate functionality from another Office program, such as Microsoft Excel or Word, into a custom form. A form can be saved as a file (for use as a template or in another program) or in a forms library (to make the form available to others).

Outlook supplies several sample forms for you.To see the sample forms included with Outlook, click  [image].

Developers can extend forms with ActiveX and OLE controls and put World Wide Web pages right on their forms by using Internet Control Pack controls. Forms can be programmed by using the Visual Basic Scripting Edition. For more information about Outlook Forms, see Building Microsoft Outlook 97 Applications. For information about how to obtain this Microsoft Press book, click  [image].

You cannot use Outlook Forms in Visual Basic and Microsoft Exchange, although you can use forms created with the Microsoft Exchange Forms Designer in Outlook.


Edit a form

1	Open the form.

How?

2	On the Tools menu, click Design Outlook Form to switch to the design mode of the page.

3	Make your changes.

4	Save the form.

How?


Change the default form for a public folder

This procedure requires owner permission. For information about how to check public folder permissions, click  [image].

1	Right-click the folder you want to specify the default form for, and then click Properties on the shortcut menu.

2	In the When posting to this folder, use box, click the form you want others to use.

Tip   To copy, install, delete, and update forms in this folder, click Manage on the Forms tab. You can also specify available forms in this folder by selecting an option under the Allow these forms in this folder box.


Item types and message classes

Message class ID	Item type is used to
Ipm.Activity	Create journal entries.
Ipm.Appointment	Create appointments.
Ipm.Contact	Create contacts.
Ipm.Document	Create documents.
Ipm.OLE.Class	Create the exception item of a recurrence series.
Ipm	If the specified form cannot be found.
Ipm.Note	Create e-mail messages.
Ipm.Note.IMC.Notification	Create a report from the Internet Mail Connect (the Exchange Server gateway to the Internet).
Ipm.Note.Rules.Oof.Template.Microsoft	Show out-of-office templates.
Ipm.Post	Post a note in a folder.
Ipm.StickyNote	Create a note.
Ipm.Recall.Report	Create a message recall report.
Ipm.Outlook.Recall	Retrieve sent messages from recipient Inboxes.
Ipm.Remote	Represent a Remote Mail message header.
Ipm.Note.Rules.ReplyTemplate.Microsoft	Edit rule reply templates.
Report	Report item status.
Ipm.Resend	Resend a failed message.
Ipm.Schedule.Meeting.Canceled	Send meeting cancellations.
Ipm.Schedule.Meeting.Request	Create meeting requests.
Ipm.Schedule.Meeting.Resp.Neg	Create decline meeting responses.
Ipm.Schedule.Meeting.Resp.Pos	Create accept meeting responses.
Ipm.Schedule.Meeting.Resp.Tent	Create tentative meeting responses.
Ipm.Note.Secure	Send encrypted notes to other people.
Ipm.Note.Secure.Sign	Send digitally signed notes to other people.
Ipm.Task	Create tasks.
Ipm.TaskRequest.Accept	Create accept task request responses.
Ipm.TaskRequest.Decline	Create decline task request responses.
Ipm.TaskRequest	Create task requests.
Ipm.TaskRequest.Update	Create updates to requested tasks.


Sample forms supplied in Outlook

Form	Description
Classified Ads	A response form used to purchase items in the classified ads, and a sample database.
Sales Management	A set of forms used to manage any generic sales process; the forms synchronize with Calendar, Tasks, Contacts, and Journal.
Training Management	Forms used to sign up for and schedule courses; the forms synchronize with Calendar.
Vacation and Sick Leave	Forms used to report vacation and sick leave; the forms synchronize with the user's Calendar.
While You Were Out	A form based on the standard "While You Were Out" form and used to take a message for another employee and then send to the absent employee's Inbox.
Note   These sample forms, with the exception of the While You Were Out form, are not installed when you setup Outlook. They are included as part of the ValuPack. Get these forms from the ValuPack folder on the Office 97 CD-ROM or on the network you installed Office from. If you didn't install Office 97 from a CD-ROM and you have access to the World Wide Web, point to Microsoft on the Web (Help menu), and then click Free Stuff.


Set properties for a form

1	Click the (Properties) page.

2	In the Form Caption box, type a name for the form.

3	To protect your form with a password, select the Protect form design check box, and then type a password in the Password and the Confirm boxes. Click OK.

4	To be able to send a copy of the form in e-mail, select the Save form definition with item check box.

5	To have the form show only for replies to messages, select the Use form only for responses check box.

6	Select other options you want.

For Help on an option, click What's This? on the Help menu, and then click the option you want.

Note   When you create a form from a mail message, the Save form definition with item check box is on. When you create a form from an appointment or meeting request, this option is off.


Use an Outlook Form in Microsoft Exchange.

Microsoft Exchange Client does not recognize Outlook Forms. A Microsoft Exchange Client user who opens an Outlook Form sees only the standard message form properties; that is, all custom fields are not visible. However, Outlook can open forms designed with the Microsoft Exchange Forms Designer.


Troubleshoot forms

What do you want help with?

Use an Outlook Form in Microsoft Exchange.

I can't find the form I created.

How can I prevent the Visual Basic Scripting Edition code from running?

How do I change information in a form that is read-only?


I can't find the form I created.

•	The form may be visible only for message responses. To trigger the response form, create a form, such as a new message form, and then send it to yourself. Open the response form, click the (Properties) page, and then clear the Use form only for responses check box. For information about how to open a form, click  [image].

•	The form may not have been saved, or it may not have been saved to a forms library. For information about how to save a form, click  [image].

•	Based on the item type used, switching to a table view may make it easier to see the form. For information about how to switch to another view, click  [image].


How can I prevent the Visual Basic Scripting Edition code from running?

To prevent any Visual Basic Scripting Edition code from running, hold down the SHIFT key. For example, hold down SHIFT while you open an item to prevent the VBScript code for the Open event from running.


Update the contents in a form that is read-only

1	Open the item based on the form you want to update.

2	On the Edit menu, click Revise Content.

3	Change the information you want.

4	Save the form.

How?


How do I change information in a form that is read-only?

For information about how to change a form from read-only so you can edit it, click  [image].


About the Control Toolbox

The Control Toolbox identifies the controls you can add to a Frame or page of a form.

You can customize the Control Toolbox in many ways including the following:

•	Add pages to the Control Toolbox.

•	Move controls from one page in the Control Toolbox to another.

•	Rename Control Toolbox pages.

•	Add other controls, including ActiveX controls, to the Control Toolbox.

•	Copy modified controls from the form to the Control Toolbox.

For example, OK and Cancel buttons are special types of CommandButtons. If you copy OK and Cancel templates to the Control Toolbox, you can quickly add them to other forms.

Note   When you add a control to a form by using the Control Toolbox, the control is not bound to a field. For information about how to bind a control to a field, click  [image].


About ToolTips and control tips

Both ToolTips and control tips are short, descriptive phrases that appear when the user holds the mouse pointer briefly over a control or another part of the user interface. The difference between ToolTips and control tips is that Microsoft Outlook provides ToolTips to developers at design time, and developers provide control tips to end-users at run time.

You can customize ToolTips for controls and for the Control Toolbox.

A control tip is set with the ControlTipText property.


Show or hide the Control Toolbox

•	In design mode, click Control Toolbox  [image].


Customize an icon for a control in the Control Toolbox

1	If the Control Toolbox is not visible, click Control Toolbox  [image].

2	Right-click the icon for the control you want in the Control Toolbox, and then click Customize control name on the shortcut menu.

3	To change the ToolTip, enter text in the Tool Tip Text box.

4	To edit the icon, click Edit Picture. In the Color box, click the color that you want to use, and then click the pixel in the Picture box where you want to apply the color. Click OK.

5	To assign a new bitmap, click Load Picture. In the File name box, type a name for the file that contains the bitmap you want to use as the icon. The bitmap cannot be larger than an icon.


Add custom controls to the Control Toolbox

You can add a modified control (based on modifications made to the advanced properties) to the Control Toolbox. You can also add other custom controls to the Control Toolbox, such as ActiveX controls that are not part of Outlook.

You can use a variety of custom controls in Outlook Forms, but there are some limitations. Although Outlook supports most ActiveX properties and methods, it does not support custom event handling. The Click event is the only event for which you can write code. To access the methods of an ActiveX control, use your VBA Object Browser to browse ActiveX control methods.

What do you want to do?

Add a modified control to the Control Toolbox

Add other custom controls to the Control Toolbox


Add a modified control to the Control Toolbox

1	If the Control Toolbox is not visible, click Control Toolbox  [image].

2	Drag a control from the Control Toolbox to your form and customize it.

For example, to create an OK button, drag a CommandButton onto the form, set its Caption property to OK, and set its Default property to True.

3	Select the customized control.

4	Drag the control to the Control Toolbox.

Note   When you drag a control onto the Control Toolbox, you only transfer the advanced property values. Any code or Outlook property values you have written for that control do not transfer with the control. You must write new code for the icon or copy code from the control on the form to the control on the Control Toolbox. For information about how to set properties for controls, click  [image].


Add other custom controls to the Control Toolbox

1	Right-click any control or an empty area on any page of the Control Toolbox, and then click Custom Controls on the shortcut menu.

2	In the Available Controls box, select the check box next to the controls that you want to add.


Change the name and control tip of a page in the Control Toolbox

1	If the Control Toolbox is not visible, click Control Toolbox  [image].

2	Right-click the label of the page that you want in the Control Toolbox, and then click Rename on the shortcut menu.

3	In the Caption box, type a new name for the page.

4	In the Control Tip Text box, type new text for the control tip.


Change the order of pages in the Control Toolbox

1	If the Control Toolbox is not visible, click Control Toolbox  [image].

2	Right-click the label of any page in the Control Toolbox, and then click Move on the shortcut menu.

3	In the Page Order box, click the name of a page that you want to move.

4	Click Move Up or Move Down.


Add a page to the Control Toolbox

1	If the Control Toolbox is not visible, click Control Toolbox  [image].

2	Right-click the label of any page in the Control Toolbox, and then click New Page on the shortcut menu.


Delete a page in the Control Toolbox

1	If the Control Toolbox is not visible, click Control Toolbox  [image].

2	Right-click the label of the page that you want to delete in the Control Toolbox, and then click Delete Page on the shortcut menu.

Note   All controls on a page are deleted when the page is deleted.


Import or export a Control Toolbox page

1	If the Control Toolbox is not visible, click Control Toolbox  [image].

2	To import a page, right-click the label of any page in the Control Toolbox, and then click Import Page on the shortcut menu.

To export a page, right-click the label of the page, and then click Export Page on the shortcut menu.

3	In the File name box, enter the name of the page that you want to import or enter the name of the file to which you want to export a page.

Note   Exporting a page does not remove it from the Control Toolbox.


Move a control to another page in the Control Toolbox

1	If the Control Toolbox is not visible, click Control Toolbox  [image].

2	Drag a control on any page to the label of another page. Hold the mouse pointer over the label until the page appears on top, and then drag on to the page.

Note   If the page to which you want to move a control is not visible, increase the width of the Control Toolbox to show all the pages, and then drag the control to the appropriate page.


Delete a control from the Control Toolbox

1	If the Control Toolbox is not visible, click Control Toolbox  [image].

2	In the Control Toolbox, right-click the control that you want to delete, and then click Delete control name on the shortcut menu.


About the object environment

There are two ways to write code for Outlook:

•	From outside the application, such as by using Visual Basic for Applications (VBA) in Microsoft Excel or another application. For information about using Visual Basic for Applications, see Help for the client application and the Microsoft Outlook Visual Basic Reference Help file (Vbaoutl.hlp).

•	From inside the application, such as by using VBScript with an Outlook Form. Some of the programming methods in VBA, for example, the use of constants, do not work in Outlook Forms.

For more information about the differences between using VBA and VBScript, click here

The major components of the Outlook object model are:

Application	The top of the object hierarchy that represents the entire application. Enables you to reference other objects in the application and create items and objects. For example, this code creates an appointment: Application.CreateItem(1).Display
NameSpace	Represents the MAPI message store where all the Outlook items are stored. Provides methods for logging on and off Outlook and for referencing the default folders such as Mailbox, Inbox, Contacts, and others. For example, this code references the active user: Application.GetNameSpace("MAPI").CurrentUser
Explorer	Represents the Outlook window. Enables you to show, return, and close the active window. For example, this code shows the active Outlook window: Application.ActiveExplorer.Display
Folders	There are two folder objects, the Folders collection object that enables you to work with collections of folders and the MAPIFolder object that enables you to work with a single folder. For example, this code shows the collection of folders named Personal Folders: Application.GetNameSpace("MAPI").Folders("Personal Folders")
Item	There are two item objects, the Items collection object that enables you to work with items within a folder and the Item object that represents the standard item types in Outlook, such as MailItem that represents a mail message. The active item is assumed, so you do not need to enter the object model to reference it. For example, this code sets the Subject field of the active message: Item.Subject = "New Subject"
Inspector	References forms. Use to show forms and pages. For  example, this code shows the Options page of a form: Application.ActiveInspector.SetCurrentFormPage("Options")
AddressEntry	Each AddressEntry object in the AddressEntries collection holds information that represents a person or process to which the messaging system can deliver messages.
AddressList	The AddressList object is an address book that contains a set of AddressEntry objects. The entire hierarchy is available through the parent AddressLists collection.
Exception	The Exception object holds information about one instance of an AppointmentItem object which is an exception to a recurring series. Unlike most of the other Outlook objects, the Exception object is a read-only object.
Control	There are two Control objects, the Controls collection object that enables you to work with all the controls on a page and the Control object that enables you to work with a specific control. For example, this code sets the Caption of a CommandButton control named “CommandButton1’ on a page named “Test”:  Item.GetInspector.ModifiedFormPages("Test").Controls("CommandButton1").Caption = "New Caption"


About using Visual Basic Scripting Edition in Outlook

Microsoft Visual Basic Scripting Edition (VBScript) is a powerful scripting language based on Visual Basic that enables you to control objects, folders, forms, items, and controls within a form. For example, you can change properties and values of controls on a page, modify the default Outlook events, and even create automated procedures, such as mailing a notice to all the contacts in a Contacts folder.

For information about Visual Basic Scripting Edition, see the World Wide Web site at http://www.microsoft.com/vbscript/. Although you can learn about VBScript in just these few Web pages, you won’t learn how to program here. To get started programming, take a look at the Microsoft Visual Basic Step by Step book available from Microsoft Press.

For the latest information about Microsoft Outlook, connect to the Outlook Web site at http://www.microsoft.com/outlook/.

For step-by-step procedures about how to use Visual Basic Scripting Edition with Outlook, see the book Building Microsoft Outlook 97 Applications available from Microsoft Press.

Keep in mind, there are two ways to write code for Outlook: from outside the application, such as by using Visual Basic for Applications (VBA) in Microsoft Excel, or from inside the application, such as by using an Outlook Form. Some of the programming methods in VBA, such as the use of constants, do not work in Outlook Forms. For information about using Visual Basic for Applications, see Help for the client application and the Microsoft Outlook Visual Basic Reference Help file (Vbaoutl.hlp).


Use the Object Browser

The Outlook object browser displays the classes, properties, methods, events, and constants available from the Outlook 98 type library. The object browser lets you view and use objects in the Script Editor and obtain information about the syntax for using the object.

For more information about viewing and using the Outlook object browser, click here

The VBA object browser is available from within Office Applications. It displays the classes, properties, methods, events, and constants available from object libraries and the procedures in your project. You can use it to find and use objects that you create, as well as objects from other applications. You can get help in using the VBA object browser by searching for “object browser” in the index tab of the VBA help file.

To view the VBA object browser from within Excel:

1	On the Microsoft Excel File menu, click New.

2	On the General page, double-click Workbook.

3	On the Tools menu, point to Macro, and then click Visual Basic Editor.

4	On the View menu, click Object Browser.

5	On the Tools menu, click References.

6	In the Available References box, select the check box next to Outlook 98 Type Library, and then click OK.

7	In the <All Libraries> box at the top of the Object Browser dialog box, click Outlook.

8	For Help about an object, click the object in the box on the left, and then click the Help button or press F1.

Note   The code examples from the object browser file are for Visual Basic for Applications and need to be modified to work within the Outlook Forms Environment in VBScript. For information about the two environments, click  [image].


Open the Script Editor

1	Open an item of the type to which you want to add code.

2	On the Tools menu, select Forms and then click Design This Form.

3	On the Form menu, click View Code.

For information about the Script Debugger, click here

For information about the Outlook object browser, click here


Test tips for using Visual Basic Scripting Edition in Outlook

There are several ways to test code in Outlook. If there is an error in the code, when you check syntax, an error message appears with the line number of the code. You can then go to the specific line of code.

What do you want to do?

Use the Script Debugger

Use message boxes to return values

Set global variables for a form

Use the PropertyChange event to test procedures

Go to a line of code


Use message boxes to return values

Use this procedure to show a message box that contains a value that you want to check.

1	Open the Script Editor.

How?

2	Enter the code you want to run. For the value that you want to check, use the MsgBox function below. This code example shows the selection length returned from the SelLength property in a message box.

MsgBox Item.GetInspector.ModifiedFormPages("Test").Textbox1.SelLength


Set global variables for a form

A global variable is available while the script is running and can be used across forms.

1	Open the Script Editor.

How?

2	Before any procedures, enter the value of the variables.

Note   If you edit code at run time, any global variables that you set are lost.


Use the PropertyChange event to test procedures

Perform the following steps to test simple procedures. Replace the code below with the code that you want to test. Each time a user changes the value of the Importance field, or any other default field, the code runs.

1	Open the Script Editor.

How?

2	On the Script menu, click Event Handler.

3	In the Events box, double-click PropertyChange.

4	Add the following code in the event:

MsgBox "This is my test procedure"

5	On the form Tools menu, select Forms and then click Run This Form.

6	Click the  !  icon on the toolbar. The message box will appear.

8	Click OK to close the message box.


Go to a line of code

1	Open the Script Editor.

How?

2	On the Edit menu, click Go To.

3	In the Line Number box, type in the number of the line of code to which you want to go.


Common things you can do with Visual Basic Scripting Edition

The following are common things you can do with Visual Basic Scripting Edition in an Outlook Form.

What do you want to do?

Create an Outlook item

Add a Click event for a control

Add an Outlook event

Reference the active user

Change a property of a control

Change the value of a field

Reference a folder

Use properties from the Microsoft Exchange Server global address list

Make a control read-only

Put a list of fields and values in the message body


Create an Outlook item

This procedure creates and shows an appointment when a user clicks CommandButton1.

1	Open the Script Editor.

How?

2	Enter the following code, using the value from the table below to specify the type of item that you want to create.

Application.CreateItem(1).Display

Type of item	Has the value
MailItem	0
AppointmentItem	1
ContactItem	2
TaskItem	3
JournalItem	4
NoteItem	5
PostItem	6


Add a Click event for a control

1	Open the Script Editor.

How?

2	For the control to which you want to add a Click event, add the following, where CommandButton1 is the name of the control.

Sub CommandButton1_Click

End Sub

3	Enter the code that you want in the event.


Add an Outlook event

1	Open the Script Editor.

How?

2	On the Script menu, click Event Handler.

3	In the Insert Events Handler box, click the event that you want to use, and then click Add.

Note   For information about Outlook events that occur at run time, click  [image].


Reference the active user

Use GetNameSpace("MAPI") to return the Outlook NameSpace object from the Application object.

1	Open the Script Editor.

How?

2	Enter the following code.

Application.GetNameSpace("MAPI").CurrentUser


Change a property of a control

1	Open the Script Editor.

How?

2	To change a property for one control on a page, use the following code. This example refers to a TextBox on page P.2 named “TextBox1”.

Item.GetInspector.ModifiedFormPages("P.2").TextBox1

To cycle through and change the Visible property on all controls on a page, use the following code.

Set myPage = item.GetInspector.ModifiedFormPages("P.2")

For i = 0 to myPage.Controls.Count - 1

myPage.Controls(i).Visible = False

Next


Change the value of a field

1	Open the Script Editor.

How?

2	To change the value of an Outlook field, use the property name of the associated standard field. For example, to change the value of the Subject field, use the following code.

Item.Subject = "New Subject"

To change the value of a custom field, use the following code to refer to a custom field.

Item.UserProperties.Find("MyProperty").Value = "New Value"


Reference a folder

1	Open the Script Editor.

How?

2	To reference a folder by the name of the folder, use the following code.

Application.GetNameSpace("MAPI").Folders("Personal Folders").Folders("Product Ideas")

To reference a folder by a number, use the following code. In this example, the first folder in the folder collection Personal Folders is referenced.

Application.GetNameSpace("MAPI").Folders("Personal Folders").Folders(1)

To reference any of the default Outlook folders, use the GetDefaultFolder method. Use the value from the table below to specify the folder you want to create.

Application.GetNameSpace("MAPI").GetDefaultFolder(6)

Default folder	Has the value
Deleted Items	3
Outbox	4
Sent Items	5
Inbox	6
Calendar	9
Contacts	10
Journal	11
Notes	12
Tasks	13


Use current user properties from the Microsoft Exchange Server global address list

1	Open the Script Editor.

How?

2	In code, open an OLE messaging session and log on, and then use the following table to reference the property you want to use.

Set olemSession = Application.CreateObject("MAPI.Session")

ReturnCode = olemSession.Logon( Application.GetNameSpace("MAPI").CurrentUser, "", False, False, 0 )

myPage = item.GetInspector.ModifiedFormPages("Message")

Set user = olemSession.CurrentUser

item.UserProperties.Find("Name") = user.Name

item.UserProperties.Find("Messaging Address") = user.Address

item.UserProperties.Find("MAPI First Name") = user.Fields.item(&h3a06001e)

Address Book Property	Reference
PR_GIVEN_NAME	&h3a06001e
PR_INITIALS	&h3a0a001e
PR_SURNAME	&h3a11001e
PR_7BIT_DISPLAY_NAME	&h39ff001e
PR_STREET_ADDRESS	&h3a29001e
PR_LOCALITY	&h3a27001e
PR_STATE_OR_PROVINCE	&h3a28001e
PR_POSTAL_CODE	&h3a2a001e
PR_COUNTRY	&h3a26001e
PR_TITLE	&h3a17001e
PR_COMPANY_NAME	&h3a16001e
PR_DEPARTMENT_NAME	&h3a18001e
PR_OFFICE_LOCATION	&h3a19001e
PR_ASSISTANT	&h3a30001e
PR_BUSINESS_TELEPHONE _NUMBER	&h3a08001e


Put a list of fields and values in the message body

1	Open the Script Editor.

How?

2	Define a variable to contain the string, and then use Outlook properties that refer to the field you want to include. For example, to include the To field in the message body, use the following. Chr (13) is the return character.

MessageString = "This letter is sent to " & Item.To & chr(13)

MessageString = MessageString & "second line goes here"

Item.Body = MessageString


ByVal References

The ByVal keyword is a way of passing the value, rather than the address, of an argument to a procedure. This allows the procedure to access a copy of the variable. As a result, the variable’s actual value cannot be changed by the procedure to which it is passed.